So i just got an assigment from my prof to make a program that would read or write a file . And i got some problem when reading an empty file , whenever i read an empty file it would input a space character and 0.0 . So is there any way to
Handle this ?
Here is my read code
void read()
{
    n = 0  ;     
    FILE *f ;
    f = fopen("namafile.txt","r");
    if (f)
    {
        while (!feof(f))
        {
            fscanf(f,"%[^|]|%[^#]#%f\n", mhs[n].nim, mhs[n].nama, &mhs[n].x) ;
            n++ ;
        }     
    }
    else
    {
        printf("file not found\n");
    }
    fclose(f) ;
}
 
     
    