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!!

If you want to use some system environments, then the getenv(3) system call would be preferede:

  #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

  #include <unistd.h>
  char *getcwd(char *buf, size_t size);
  char *get_current_dir_name(void);
  char *getwd(char *buf);