Yeh, my initial thoughts about the newline character were wrong. I'm just testing the code now to see what the issue is.
[EDIT]
You might need to post the rest of your code, because this works fine for me:
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX_COLUMNS 80
int main(int argc, char *argv[])
{
int i;
FILE *fp;
char *filename = "balls.txt";
char thisline[100];
fp = fopen( filename, "r" );
while ( NULL != fgets(thisline, MAX_COLUMNS + 1, fp))
{
i = 0;
while ( '\0' != thisline[i] )
{
i++;
printf("%d\n", i);
}
}
system("PAUSE");
return 0;
}
Text file:
1asd asdas as asf asf
2ihasdia sdqad qewf qw ef
3khafdwe wef we fwe f