I’ve been trying to use the fscanf function to read a txt file containing a single number into a ptr:
(file.txt)
1
File *fPtr=fopen(“file.txt”, “r”)
int r;
fscanf(fPtr, “%d”, &r);
I keep getting a segmentation fault, after running it though the program compiles. It happens pretty much any other way I try to call Fscanf too.