I was trying to read a file char by char but the debugger when reaches the fscanf gives back a segmentation fault error, here's my code:
int main(){
FILE *inFile;
char *carattere = NULL;
inFile = fopen("../file.txt", "r");
if (inFile == NULL){
return -1;
}
while(fscanf(inFile, "%c", carattere) != EOF){ //segmentation fault
printf("%c ", *carattere);
}
fclose(inFile);
return 0;}
(I've recentely reinstalled my IDE).