Hello, I'm trying to use codeblocks to open a text file in C. I can't open the text file, the text file is placed in the directory where the 4DE_file.c is placed. This is the C code:
#include <stdlib.h>
#include <stdio.h>
int main() {
FILE *puntaFile;
char c;
puntaFile=fopen("nomi.txt","r");
if(puntaFile != NULL) {
printf("sono dentro!");
c = fgetc(puntaFile);
while(c != EOF)
{
putchar(c);
c=fgetc(puntaFile);
}
fclose(puntaFile);
}
else {
printf("the file can't be opened !");
return 1;
}
}
The output I get is: "the file can't be opened".
Is there any particular configuaration I should do before using files ?