how would I count the lines in a file?
I want to get a new unique ID# for a simple DB by counting the records and assigning this number + 1 for each new record.
The lines in the .txt file are as follows
<TABLE><TABLE BORDER><TH> ID#<TH> FIRST NAME<TH> LAST NAME<TH> TEST 1 <TR>
I have tried this but it doesn't work
FILE *r ;
r = fopen(datafile,"a"); // I'll error check later if
//I get this bit to work first
if(inchar == '\n')
linecount remains at 0 (the swine)
The function which printed the file is
so there is a \n in there to be counted.
I have tried numerous other ways from the C board archives
but nothing works!
what am I doing wrong?
any help would be greatly appreciated.