I am trying to read a file which is located at the same source as my .c code. I tried this little sketch and same problem. What could be wrong? File's extension and name are just the same.
#include <stdlib.h>
#include <stdio.h>
int main (){
char caracter;
FILE *ARCHIVO;
ARCHIVO=fopen("prueba.txt", "r");
if (ARCHIVO==NULL){
printf("Error·");
}else{
while (feof(ARCHIVO)==0){
caracter=fgetc(ARCHIVO);
printf("%c", caracter);
}
}
fclose(ARCHIVO);
return 0;
}
I will be very thankful if someone could help me. Regards.