As the title implies I am trying to open a text file in the same directory as of the program I'm running. Here is the code I am using:
int main(int argc, char *argv[]){
FILE *filePtr;
filePtr = fopen("something.txt", "r");
if (filePtr == NULL){
printf("Oh dear, something went wrong with read()! %s\n", strerror(errno));
return 1;
}
return 0;
}
This prints out:
Oh dear, something went wrong with read()! No such file or directory
I have also tried using fopen("./something.txt", "r");
but the same thing happened.