how do i get the environment variable

This is a discussion on how do i get the environment variable within the C Programming forums, part of the General Programming Boards category; On a windows machine in command prompt when i type "set" i get a list of environment variables. How do ...

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    13

    how do i get the environment variable

    On a windows machine in command prompt when i type "set" i get a list of environment variables. How do i access these from a c program. I am looking for the variable called "USERPROFILE"

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,672
    Quote Originally Posted by Harman
    how do i get the environment variable
    There is a function called getenv you should look into.
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    Registered User
    Join Date
    May 2005
    Posts
    13
    thanks, as you can guess i am very new to c.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help...
    By darkconvoy in forum C Programming
    Replies: 32
    Last Post: 04-29-2008, 03:33 PM
  2. which variable can store words?
    By Hunterofman in forum C++ Programming
    Replies: 8
    Last Post: 04-28-2008, 05:59 PM
  3. global and static variable in a class delivered in a DLL
    By George2 in forum C++ Programming
    Replies: 16
    Last Post: 04-13-2008, 08:19 AM
  4. Retrieving PATH Environment Variable
    By mercury529 in forum Windows Programming
    Replies: 9
    Last Post: 01-09-2007, 07:02 PM
  5. Win Console program environment variable
    By C3Pnuts in forum C Programming
    Replies: 2
    Last Post: 05-23-2005, 02:08 PM

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