FILE and strtok problems (C Linux)
Good day,
I am having a compiling error with my code.
Code:
#include <stdio.h>
#include <string.h>
#define SIZE 81
int main(void)
{
int maxLoop = 100;;
char *status;
FILE *infile, *outfile;
infile = fopen("worker.txt", "r");
outfile = fopen("outputData.txt", "w");
struct
{
char employeeNum[10];
char firstName[25];
char lastName[25];
char hoursWorked[5];
} groupDetails[SIZE];
status = fgets((char)*groupDetails, SIZE,infile);
while (status != NULL)
{
fputs((char*)groupDetails,outfile);
status = fgets((char*)groupDetails,SIZE,infile);
}
fclose(infile);
fclose(outfile);
system("pause");
return 0;
}
The problem is, it's giving me an error on pointers in the status = fgets...
can somebody help me on this?
in addition, I need help on reading a line in the text file.
am I doing it right? and how can I properly implement strtok here?
thank you so much.