pwd

V

vertigo

Hello
How can i read current working directory in unix
(from c program) ?

Thanx
Michal
 
M

Markus Pitha

Hello,
Im not sure, what you exactly mean with current directory, but is
something like this, what yousearch for?

#include <stdio.h>

int main(void) {
char tmp[20];
sprintf(tmp, "ls -al");
system(tmp);

return 0;
}
 
M

Markus Pitha

Sorry, acutally you don't need sprintf.
system("ls -al"); does it as well.
I used sprintf because i always had to combine some strings in one order.
 
M

Mark McIntyre

Hello
How can i read current working directory in unix
(from c program) ?

By using unix-specific function calls. You'd need to ask in a unix
programming group about that, as ISO C doesn't support any specific
platform
 
G

guggach

hi
does he not speaks about:
current working directory in unix in 'c'
?????????
google for 'unix man getcwd


-
guggac
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top