I wrote a C program to read records from a file using structure but when i compiled it i got few extra characters apart from those which are written in my file "EMPLOYEE". So Please resolve my issue. Screenshot of the file content and debug console has been attached herewith.
Here is the C Program---
include<stdio.h>
include<conio.h>
include<stdlib.h>
int main()
{
FILE* fp;
errno_t err;
char another = 'Y';
struct emp
{
char name[31];
int age;
float bs;
};
struct emp e;
err = fopen_s(&fp, "EMPLOYEE.DAT", "r");
if (err != 0)
{
puts("Can Not Open file");
exit(1);
}
else
while ((fscanf_s(fp,"%s%d%f",e.name, sizeof(e.name), &e.age, &e.bs)) != EOF)
printf("%s%d%f\n", e.name, e.age, e.bs);
fclose(fp);
return 0;
}