printf ("Enter the employee's number: ");
int number;
scanf ("%d%*c", &number);
printf ("Employee\'s number: %d\n", number);
Employee *e;
while ( (e = file_read_employee (f)) && (e->number!=number) );
if (!e)
{
fprintf (stderr, "There is no such employee.\n");
return EXIT_SUCCESS;
}
printf ("Deparment: %d\nPay rate: %f\nExempt: %c\nHours worked: %d\nBase pay: %f\n",
e->department, e->rate, e->exempt, e->hours, e->rate*(float)e->hours);
return EXIT_SUCCESS;
}
This is what the errors say:
cpp(17) : error C2440: 'initializing' : cannot convert from 'void *' to 'Employee *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
malloc returns a void*. You are storing the result in an Employee*.
The compiler cannot (will not) implicitly convert the void* return value of malloc
to an Employee*. You have to explicitly cast it.
__func__ is undefined. I don't know what the symbol is in microsoft
land, but for gcc it is __FUNCTION__ or __PRETTY_FUNCTION__.