I need to get the file path of a file i recently created in c
FILE *pFile;
pFile=fopen("client.txt","w");//create and open file in write mode
now how can i get the file path of client.txt?
You need the current working directory. getcwd will do this for you.
This should work
#include <unistd.h>
#include <linux/limits.h>
char path[MAX_PATH + 1];
char *cwd = getcwd(path, MAX_PATH);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.