So I'm scanning strings from a file and comparing them with the string from a stack. If i scan all the string from the file and don't find the one from the stack i want to rewind the file, pop the string from the stack and continue unless the stack is empty.
char buffer[ENOUGH];
while(fscanf(stream, "%s", buffer) != EOF)
{
if(strcmp(buffer, tos->string) == 0)
{
pop(&tos);
//do something with the string
}
// here i would need something to stop the EOF
}
I have a file like this:
02.01.2021 8:45 8:57 9:45
03.01.2021 15:40 16:30
05.01.2021 07:30 08:30
And stack contains:
01.01.2021 <- TOS
02.01.2021
03.01.2021
04.01.2021
So i need to find 01.01.2021 in file and if not there remove it from stack.