Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to read specific part of file which includes strings and integers in c?

0
Posted

How to read specific part of file which includes strings and integers in c?

0

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

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123