File Input from structue???
I have a quick question about inputting data. More specifically data that is of the fallowing struct
Code:
enum sex {male, female};
struct data
{
char name[30];
sex MF;
int age;
double weight;
};
Some one has asked me for some help with this but I cant seem to work out how to input the data from this file. if anyone wants to view the file. I have been told that its formatted as per the above structure.
All of the input and output I have always uses was using the fallowing method.
Code:
FILE *input; // declare a pointer of type FILE
char buffer[400]; // a buufer array
input=fopen("C:\\Sales.txt","r"); // opens file
read(buffer,1,200,input); // read 200 characters to buffer
Is there someway to use the above method? Or is there an alternative?