Create a gist now

Instantly share code, notes, and snippets.

@eQu1NoX /test-getcwd.c Secret
Created May 27, 2014

What would you like to do?
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, const char *argv[])
char buf[9000];
char *ptr = getcwd(buf, 9000);
if (ptr == NULL) {
printf("Unable to use getcwd\n");
printf("Error - %s\n", strerror(errno));
printf("The buffer address is %p\n", ptr);
printf("The path is -- %s\n\n", ptr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment