How to read specific part of file which includes strings and integers in c?
THE objective of code i am trying to write is to 1)ask user to enter name,roll no,marks {read name,roll number, and marks in one subject of n number of students ,,,,,,,and store in a simple file,,,,,,} 2)ask user to enter roll number of a student {search the roll no in file and display the corresponding all his records i.e display name ,roll number and marks.} …………to do this i created a structure as follows struct data { char name[26]; int marks1,roll; }info[10]; ……….and the read the data from user and entered into file using fprintf fprintf(p,”%d%s%d”,info[rec].roll,info[r… where p is pointer to file “student.doc”…….AND REC IS N th record then i read roll from user ,FURTHER I DONT GET HOW TO SEARCH PERTICULAR ROLL (THE ONE USER HAS ENTERED)FROM FILE AND PRINT THE RECORD I TRY searching as follows ————————————–… scanf(“%d”.&n); i=0; while( !eof(p)) { fscanf(p,”%d”,info[i],roll); if(nfo[i],roll==n) break; i++; } fscanf(p,”%d%s%d”,p,&info[i].rol