Hello experts,
Here is my code.I can create the database.But I also want it to see standard output.Please see the blocked code.If i use them they show me weired symbols.
#include <stdio.h>
#include <stdlib.h>
struct date {
int month;
int day;
int year;
};
struct empRec{
char name[25];
char room[10];
int jobLevel;
struct date startDate;
};
int main(){
FILE *data;
static struct empRec employee[1000]={
{"Peter North","4B-208",35400,{10,11,1983}}
};
int entries=6;
if((data=fopen("database","w"))==NULL){
fprintf(stderr,"Can't Create database\n");
exit(1);
}
if(fwrite(employee,sizeof(struct empRec),entries,data)!=entries){
fprintf(stderr,"WRITE ERROR\n");
exit(1);
}
/*char buf[1024];
rewind(data);
fread(buf,sizeof(struct empRec),6,data);
printf("%s\n",buf);
*/
fclose(data);
printf("Created database\n");
exit(0);
}