Originally Posted by
Salem
There must be something else going on, because that doesn't make any sense
This is the code I used to call the function (the "!feof(Input)" while loop is infinitely repeated because the file pointer doesn't increment, it just prints the first line over and over):
Code:
FILE *Input;
char Line[256];
char Comment_Prefix[2] = "//";
int Line_Length;
int Prefix_Length = strlen(Comment_Prefix);
Input = fopen("test.txt", "r");
if(Input != NULL){
while(!feof(Input)){
Next_Line(&Input, Line, sizeof(Line), Comment_Prefix);
printf("%s", Line);
}
fclose(Input);
}
And this is the test file I had it read:
Code:
TEST TEST TEST 1
TEST 2
TEST 3
//TES TEST TEST
//TEST
Test 4
Ttest 5 // TEST
TEST
Other than that I have no idea what other factors could contribute to fgets not working properly.