![]() |
|
#1
|
||||
|
||||
Current working directory.How do I get the current working directory name ?
I read about getcwd but I can't use it. The compiler shouts that it can't open <unistd.h> . I'm interested in an ansi-c function that will do the job. Anyone ? Should I write my own function based on argv[0] ? Kobi. |
||||
|
#2
|
|||
|
|||
|
Quote:
There is no standard C (or C++) library function for getcwd --- it's operating system dependent. Here's what works for me with Borland bcc32 and Microsoft Visual C++. (For other, non-unix like, compilers, you can grep around in your include directory to see if there is something like getcwd().) CPP / C++ / C Code:
Problem with argv[0]: 1. Not all compilers generate code that puts the entire path in argv[0] (in my case, Borland bcc32 does, but the Microsoft compilers give just the program name, not the path). 2. Even with the Borland compiler, argv[0] gives the path to the executable program, not the current working directory from which the program was invoked. Regards, Dave |
|
#3
|
||||
|
||||
Then I will write my own code :-)Hey, Dave.
Thank's for your code and advice. I will use your example and try to write my own generic function and post it. Best regards, Kobi. |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linked Lists | DCOM | C Programming Language | 4 | 27-Mar-2005 01:00 |
| GIMcontacts - a gim fltk fluid venture | cable_guy_67 | FLTK Forum | 0 | 14-Feb-2005 15:18 |
| fltk-2.0 cvs | Plumb | FLTK Forum | 20 | 13-Nov-2004 08:10 |
| Apache2 config issues | monev | Apache Web Server Forum | 2 | 28-Jun-2004 07:19 |
| Can't view pages from another machine on the Intranet | aevans | Apache Web Server Forum | 9 | 14-May-2004 03:26 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The