×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    35

    Whether to use "strlen()" or "wcslen()" ?

    Hi All, I am confused between usage of "strlen()" and "wcslen()".
    While writing Qt application on SymbianS60 what must be used?
    If this is already discussed please give the link.

    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Whether to use "strlen()" or "wcslen()" ?

    The proper way is to use QString::size()
    http://doc.trolltech.com/4.6/qstring.html#size

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    35

    Re: Whether to use "strlen()" or "wcslen()" ?

    Hi Divanov, thanks for your quick reply.

    Please look at the code snippet where I want to use it.
    Given that i m trying to port an S60 application to Qt
    so i would like to retain the logic in S60 manner and i 'll change only UI control in accordance with Qt. Anyway this is my understating, if any good approach would be there, please share the link.

    #define DEFAULTFULLKEY _T("ABCDEFGHIGKLMNOP")
    TCHAR g_DefaultKey[] = ATXDEFAULTFULLKEY;
    TBuf<128> licenseKey;
    icenseKey.Copy((TUint16*)g_DefaultKey, wcslen(g_DefaultKey));

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Whether to use "strlen()" or "wcslen()" ?

    Code:
    QString licenseKey("ABCDEFGHIGKLMNOP");
    There is a link about conversion between QString and Symbian descriptors
    http://library.forum.nokia.com/index...3CF56D948.html
    Last edited by divanov; 2010-04-13 at 14:28. Reason: link fixed

  5. #5
    Registered User
    Join Date
    Mar 2007
    Posts
    35

    Re: Whether to use "strlen()" or "wcslen()" ?

    Thanks for your quick reply.
    So you mean every TBuf has to be replaced with QString.
    But as I said earlier engine part of the application i would like to retain and only UI part has to be changed. So here engine is Platform dependent (Symbian specific).So there is no good point in changing all Tbuf to QString.I understand changing these will make the application platform independent but at this point I am not looking at making the application platform independent.
    http://library.forum.nokia.com/index...3CF56D948.html
    Above link is not opening. NotFound: 404
    I guess ... in your link is not proper.
    Thanks,
    Kalinga

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Whether to use "strlen()" or "wcslen()" ?

    Quote Originally Posted by kalinga_ray View Post
    http://library.forum.nokia.com/index...3CF56D948.html
    Above link is not opening. NotFound: 404
    I guess ... in your link is not proper.
    Thanks,
    Kalinga
    The link was fixed.

  7. #7
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Whether to use "strlen()" or "wcslen()" ?

    Above link is not opening. NotFound: 404
    It's a curious "feechure" of the Nokia site that you often have to try a link 2-3 times before you get to the right location.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×