The three things mentioned in the title are somewhat new to me. I am familiar with all of them conceptually but this is the first time I have tried to write my own program from scratch in C++ and it involves all three of these things. Here is the code:
int main(int argc, char *argv[])
{
FILE *dataFile;
char string [180];
dataFile = fopen(argv[1],"r");
fgets(string,180,dataFile);
fclose(dataFile);
}
It compiles fine, but when I execute using a simple input text file I get a segmentation fault. I have searched multiple tutorials and I can't figure out why. Any help would be appreciated.