I read string from file if the string in the file is:
"User1 User2 User3 User4 User5"
"test1"
i want to read only the first line from the file,my code is:
if (in_fp != NULL)
{
while (fscanf(in_fp, "%s", &user)!=EOF)
{
temp = (char*)malloc(sizeof user);
strcpy(temp,user);
}
fclose (in_fp);
}
but the problem is that fscanf read also that "test1" from the text file,i need to know how to make him to know that is the end of the line,what i need to fix in my code? i know about fgets but i want to read each user separately