#include <stdio.h>
int main (void)
{
int col1, col2;
FILE *fname = fopen("1930_2001.txt" , "r");
fscanf(fname , "%d" , &col1);
}
Whenever I try to get information from the data file, before I even do that, I get an error that it can't access the information. It says it's "NULL" and I have the file in the debug folder in Xcode of my project. Any help?
Have you put your data file and the compiled binary into the same folder? Xcode put the binary in somewhere not easy to find, you can Option+click the target name and choose "Show in Finder".
Or you can also compile your project using xcode-build CLI tool, or directly compile your program using clang, which saves you from lots of trouble.