02-14-2008 07:12 AM
02-14-2008 07:42 AM
int i, line;
int fH = 0, cnt = 0, ioerr = 0;
char msg[512], file[MAX_PATHNAME_LEN];
// 'file' must contain the file pathname
fH = OpenFile (file, VAL_READ_ONLY, VAL_APPEND, VAL_ASCII);
while (TRUE) {
// Count rows
ioerr = ReadLine (fH, msg, -1);
if (ioerr == -2) break; // End of file
if (ioerr == -1) { // I/O Error
line = __LINE__; ioerr = GetFmtIOError (); goto Error;
}
cnt++;
}
SetFilePtr (fH, 0, 0); // Return to beginning of file