August 17, 2001, 12:00 AM — This week, I will demonstrate three techniques for obtaining a
process's current working directory from a program.
The getcwd() Syscall
The getcwd() syscall that retrieves the current working directory is
char * getcwd(char * buf, size_t max_size);
A getcwd() call fills the argument buf with the path of the current
working directory. The path's length may not exceed max_size