This works:
Code:
int GetWord(FILE *inp, char *string)
{
int i=0;
printf("\n\n==================================");
printf("\nFunction output\n");
while (string[i]!= '\"' && string[i]!= EOF)
{
string[i] = fgetc ( inp );
printf("%c ", string[i]);
i++;
}
if (string[i] == NULL)
return 0;
else
return 1;
}
and the call:
Code:
check = GetWord(inp, Word);
if (check)
printf("\n\n* %s\n\n", Word);
But the loop control is off. I'm looking for the first white space with \", but it goes on past it, until it feels like stopping.
ie: input file:
Code:
May June July August
Setember October
the function stores this in Word:
Code:
May June July August
Setember