Help


 
Thread Tools Search this Thread
Top Forums Programming Help
# 1  
Old 05-04-2008
Help

Hi, i have a question is there any way to store a system call (like pwd, or the path of a working directory) to a variable using C?? or is there another way that i can obtain the PATH??, and how can i use the same var to do a cd or make a file.

thank you in advance!!

Last edited by kyubiii; 05-04-2008 at 01:57 PM..
# 2  
Old 05-04-2008
If you want to use some system environments, then the getenv(3) system call would be preferede:
Code:
  #include <stdlib.h>
  char *getenv(const char *name);

If it's something like the current directory, getcwd(3) might be what you're looking for
Code:
  #include <unistd.h>
  char *getcwd(char *buf, size_t size);
  char *get_current_dir_name(void);
  char *getwd(char *buf);

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question