
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>getcwd</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
getcwd
Usage
#include <direct.h>
char *getcwd(char *buffer,int length);
Description
Stores the drive and path name of the current directory in buffer. If
buffer is NULL, getcwd will malloc enough bytes to hold the path
including the terminating 0. At least length bytes will be allocated.
Example
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *buff;
if((buff = getcwd(NULL,0)) == NULL) {
perror("getcwd error");
return EXIT_FAILURE;
} else
printf("%s",buff);
return EXIT_SUCCESS;
}
Return Value
Returns buffer on success. A return value of NULL indicates an error and
errno is set to:
ENOMEM out of memory.
See Also
chdir, mkdir, rmdir
See Also: chdir mkdir rmdir
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson