getenv

This is a discussion on getenv within the C++ Programming forums, part of the General Programming Boards category; #include <iostream.h> #include <stdlib.h> int main() { cout<<getenv("PATH"); return 0; }//end main I need to parse the string and print ...

  1. #1
    Unregistered
    Guest

    Question getenv

    #include <iostream.h>
    #include <stdlib.h>

    int main()
    {

    cout<<getenv("PATH");
    return 0;
    }//end main


    I need to parse the string and print each directory on one line. Can someone point me in the right direction. Thanks in advance

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    just parse the string for the '\\' that seperates the directories and then split each one accordingly.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getenv() causes segfault in recv() loop
    By MK27 in forum Networking/Device Communication
    Replies: 3
    Last Post: 12-05-2008, 01:04 PM
  2. sprintf getenv buffer overflow
    By bue in forum Linux Programming
    Replies: 7
    Last Post: 08-15-2005, 07:17 AM
  3. question about getenv...etc???
    By smd in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2003, 04:32 AM
  4. QUERY_STRING in CGI with a C/C++ Program
    By stovellpaul in forum C++ Programming
    Replies: 5
    Last Post: 10-03-2002, 12:51 AM
  5. getenv function
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 04-15-2002, 09:51 AM

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