well to start off...
a college course i am taking has a C module on it and we just had our finnal test using file i/o, i done it one way and the lecturer said its bad and i lost 10 marks..now he seems not to bright and im really sure my way is more efficiant..here is how it went
Code://my way while(!feof(fp)) { fscanf(fp , "%d %f %d" , &amount , &cost, &rate); i++; }he has told me my way will crash the program if the file is empty (he seems to think u need to read from the file first before u can use feof on it) and he said it will produce garbage in the arraysCode://lecturers way fscanf(fp , "%d %f %d" , &amount , &cost, &rate); while(!feof(fp)) { fscanf(fp , "%d %f %d" , &amount , &cost, &rate); i++; }
can some one please give me some opinions on this and some ways to try and get him to give me 10 points back, thanks



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.