Unix to Windows Porting Dictionary for HPC |
|
|
RSS
LinksFunction List
|
Table of Contents This function places the full path of the current working directory in buffer, and returns a pointer to buffer; this can also be NULL. The maxlen argument specifies the maximum length for the path. Since this function has a one-to-one correspondence with the _getcwd function in Windows, there should not be any other changes required other than renaming the function and including the header file.
#include <direct.h>
char* buffer;
buffer = _getcwd(NULL, 0);
if (buffer != NULL)
printf("Current working directory is %s.", path);
else
printf("_getcwd error.");
|
|
|
|