ummm... are you checking the length of a string, or a file??? i have code for both of these maybe..
i didn't test this because i'm not at a computer with a compiler, and this may, of course, be completely incompilable, but it is woth a try...
code:
//for a string argument//
//include string.h for this to work//
unsigned long count(char file[ ])
{
unsigned long a;
a = strlen(file);
return a;
}
//and for the file//
//include stdio.h//
unsigned long count(FILE * file)
{
unsigned long a;
char c;
while(!(feof(file))
{
if (file)
{
c = fgetc(file);
a++;
}
}
return a;
}




Reply With Quote