L macro

This is a discussion on L macro within the C Programming forums, part of the General Programming Boards category; Hello everyone, I am using Visual Studio 2003 and Windows Console project, I find when using L macro to convert ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    L macro

    Hello everyone,


    I am using Visual Studio 2003 and Windows Console project, I find when using L macro to convert character to wide character, the compiler will report an error that L macro is not defined.

    I find it is not defined in either <windows.h> or <TCHAR.h> -- when adding the two header files, the compile error is the same.

    Could anyone explain how to use L macro in Visual Studio 2003 and Windows Console project? Which header file is needed?


    thanks in advance,
    George

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,832
    There is no L macro, it is a prefix
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    int main(){
        wchar_t foo[] = L"hello";
        return 0;
    }
    In your compiler, to permit easy switching between ASCII and UNICODE, there are the _T and _TEXT macros.
    Something like
    TCHAR foo[] = _TEXT("hello");

    See also
    http://msdn2.microsoft.com/en-us/lib...21(vs.71).aspx
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 10:13 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 11:17 AM
  4. Macro Program
    By daspope in forum Windows Programming
    Replies: 5
    Last Post: 04-25-2004, 05:02 AM
  5. about Makefile and Macro
    By tom_mk in forum C++ Programming
    Replies: 1
    Last Post: 09-18-2003, 02:07 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21