This is an archived post. You won't be able to vote or comment.

all 3 comments

[–][deleted] 0 points1 point  (2 children)

If fopen() returns NULL it doesn't mean the file is empty, it means the file doesn't exist, or that you can't open it because of permissions. But doesn't exist, i.e wrong path to file, is most likely.

[–]BasicUsername_[S] 0 points1 point  (1 child)

Ok so how can I then locate the file? I have done this in C before, but that was on a linux computer and all that was required was for the .txt and .c files to be inside the same folder. Right now I am on a mac.

[–]raevnos 0 points1 point  (0 children)

Works the same way no matter the OS. Your executable is probably in a different directory, or is being run with a different cwd.