Thread: Win32 API to concert enviornment variable to string

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    113

    Win32 API to concert enviornment variable to string

    Hi !

    I want to know the win32 API function or MFC class which can convert the value of

    environment variable %allusersprofile% value to string.........

    i.e. when I enter "%allusersprofile%" on run command it open the location "C:\Documents

    and Settings\All Users".............

    I want this location in string in my program.............

    can any body help me ..........

    Any queries are most welcomed and also hints............

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I managed to get a sensible result from
    Code:
    ....
    char *s;
    
    s = getenv("allusersprofile");
    ...
    I'm not saying that is the "best" way to solve it, but it's portable (but the "allusersprofile" is obviously pretty windows oriented) and does the job.

    --
    Mats

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    113

    thanks

    Hi Map!

    Thanks for your help..........

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  2. assigning a string to a variable
    By xp5 in forum C Programming
    Replies: 12
    Last Post: 08-30-2007, 01:13 AM
  3. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 06:52 PM
  4. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 PM
  5. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM