dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: _T("") vs L""

  1. #1
    Join Date
    Feb 2008
    Posts
    72

    _T("") vs L""

    Anyone explain these two? I am seeing codes that uses _T("texts here") and also L"Texts here"

  2. #2
    Join Date
    Apr 2008
    Posts
    133

    Re: _T("") vs L""

    Prefixing string with L modifier makes the string a wide char which is needed for Unicode strings. However having _T() or _TEXT() is preferred since it will switch between MBCS and Unicode mode strings as required

  3. #3
    Join Date
    Jan 2008
    Location
    India
    Posts
    408

    Smile Re: _T("") vs L""

    Try this link for Data type Mappings

    http://msdn.microsoft.com/en-us/library/se784sk6.aspx

    And here are some sample codes

    http://msdn.microsoft.com/en-us/library/4t912wf5.aspx

    Bharani.
    Rate the posts which you find useful

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,146

    Re: _T("") vs L""

    If you are compiling in ANSI (MBCS), use _T(""). This will allow you to transition to UNICODE with the minimum amount of trouble.
    If you are compiling in UNICODE (and never need to compile in ANSI), use L"".

    Don't ever code with "".

  5. #5
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496

    Re: _T("") vs L""

    Quote Originally Posted by pinoywebdev
    Anyone explain these two? I am seeing codes that uses _T("texts here") and also L"Texts here"
    A slight variation of what the previous people said: use L when you need UNICODE regardless of the project settings. ( in cases where a function accepts only wide char strings)
    Har Har

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)