Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > pwd

Reply
 
 
vertigo
Guest
Posts: n/a
 
      09-12-2004
Hello
How can i read current working directory in unix
(from c program) ?

Thanx
Michal
 
Reply With Quote
 
 
 
 
Markus Pitha
Guest
Posts: n/a
 
      09-12-2004
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;
}


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

 
Reply With Quote
 
 
 
 
Markus Pitha
Guest
Posts: n/a
 
      09-12-2004
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.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      09-12-2004
On Sun, 12 Sep 2004 17:48:52 +0200, in comp.lang.c , vertigo <>
wrote:

>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
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>


----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
 
Reply With Quote
 
c453___
Guest
Posts: n/a
 
      09-12-2004
try those:
#include <dirent.h>
opendir() , readdir()
 
Reply With Quote
 
guggach
Guest
Posts: n/a
 
      09-14-2004

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


-
guggac
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"User cannot change pwd" and "Pwd never expire" by using Directory Thauhtopa ASP .Net Security 4 12-07-2004 06:55 AM
Pwd MCSE Windows 2000 Server.pdf Neo Microsoft Certification 11 06-03-2004 04:07 AM
Config not working ? Anyone help troubleshoot ? & pwd recovery question Jeff Mac Pherson Cisco 3 01-27-2004 04:57 AM
Encrypt line pwd Warrick FitzGerald Cisco 1 12-22-2003 01:34 PM
no console and cant recover pwd Mark Reed Cisco 6 12-15-2003 10:43 PM



Advertisments