Thread: Hot to declare a LPTSTR

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    161

    Talking Hot to declare a LPTSTR

    Code:
    char* winPath[MAX_PATH];
      
      GetWindowsDirectory(winPath, MAX_PATH);
      printf("%s\n", winPath);
    [Warning] passing arg 1 of `GetWindowsDirectoryA' from incompatible pointer type
    from http://msdn.microsoft.com/library/de...sdirectory.asp :

    LPTSTR lpBuffer, Pointer to the buffer to receive the null-terminated string..
    How should I declare it? thanx!
    This forum is the best one I've ever seen. Great ppl, great coders

  2. #2
    Dump Truck Internet valis's Avatar
    Join Date
    Jul 2005
    Posts
    357
    GetWindowsDirectory((LPTSTR) winPath, MAX_PATH);
    Here are the definitions:
    Code:
    #define FAR                 far
    typedef wchar_t     TCHAR;
    typedef TCHAR FAR *			LPTSTR;

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    thanx
    This forum is the best one I've ever seen. Great ppl, great coders

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    69
    Actually this is what you want to do:
    Code:
    	TCHAR winPath[MAX_PATH];
    	GetWindowsDirectory(winPath, MAX_PATH);
    The name of a char, or TCHAR, array is already a pointer.

    Regards,
    Brian

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. People sure are serious about their hot sauce...
    By indigo0086 in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 06-26-2008, 02:55 PM
  2. Can you Microwave Regular Hot dogs?
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 38
    Last Post: 01-11-2005, 01:53 AM
  3. A Miracle has occurred in the realm of Hot Dogs
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-08-2004, 03:18 PM
  4. program won't run properly, help needed asap
    By jlmac2001 in forum C Programming
    Replies: 2
    Last Post: 11-16-2002, 09:52 AM
  5. help getting program to work
    By jlmac2001 in forum C Programming
    Replies: 2
    Last Post: 11-13-2002, 11:04 PM