I'm trying to open a .txt file from a program in my bin directory but I'm not sure what search path it uses to find folders. I'm using fopen in my program to open these files. I've tried several paths but it doesn't seem to work:
char path[80] = "../Users/MyName/Desktop/Folder/";
char path[80] = "Users/MyName/Desktop/Folder/";
char path[80] = "Folder/";
char path[80] = "";
Any help would be appreciated
use absolute path:char path[80] = "/Users/MyName/Desktop/Folder/"
, or use getcwd
to get current working directory, then use relative path, or use chdir
to change working directory to the directory you want to access, then open the file.