Read space separeted string from file into a single variable
I have a file containing a list of tasks with they status:
PENDING Task number 1
COMPLETED Task number 2
COMPLETED Task number 3
I'm trying to read this file with:
char status[10];
char text[1024];
while(fscanf(file, "%s %s", status, text) != EOF) {
printf("%s %s\n", status, text);
}
However the output is completly wrong. Only the first word of the task
text gets to the text variable. How can I fix this?