Environment: Fedora 22 + QT
Aim: get current working directory.
Code example:
char* buffer;
if((buffer=getcwd(NULL,0))==NULL){
perror("getcwd error");
}else{
printf("%s\n",buffer);
free(buffer);
}
Error:
getcwd was not declared in this scope
Solution: add following code in your source file:
#include <unistd.h>