Thank you for replaying.
The file I'm using exists. It contains integer numbers just like this:
1
5
65
3
There are no restrictions but it should be simple.
Code:
int main(){
FILE *data;
int array[100],i=0,j,k;
data=fopen("data.txt","r");
if(data==NULL){
printf("There was a mistake\n");
exit(1);
}
do{
j=fscanf(data,"%d",array[i++]);
}while(j!=EOF);
for(k=0;k<sizeof(array);k++){
printf("The value os the array in the position %d is %d\n",k,array[k]);
}
return 0;
}
I think there is no problem when opening the file. I think the mistake is afterwards.
Thank you so much.