My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
C Program of file handling with output
Posted Date: 15 Mar 2008 Resource Type: Articles/Knowledge Sharing Category: Computer & Technology
|
Posted By: ashish singh Member Level: Diamond Rating: Points: 5
|
/* Program of file handling */ #include #include struct student { char name[2]; char f_name[20]; int roll_no; float fee; }; void main() { FILE *fp; int n,i,r; float f; struct student s; clrscr(); fp=fopen("c:\\seema\student","w"); if(fp!=NULL) { printf("\n File opened sussessfully "); else { printf("\n Error in opening "); return; } printf("\n Enter total no. of record :"); scanf("%d",&n); for(i=0;i { fflush(stdin); printf("\n Enter name :"); gets(s.name); printf("\n Enter f_name :"); gets(s.f_name); printf("\n Enter roll_no :"); scanf("%d",&r); s.roll_no=r; printf("\n Enter fee :"); scanf("%f",&f); s.fee=f; fprintf(fp,"%d %s %s %f",s.roll_no,s.name,s.f_name,s.phone_no,s.fee); } fclose(fp); getch(); } Output: File opened sussessfully Enter total no. of record :2 Enter name :Seema Rani Enter f_name :R.S.Yadav. Enter roll_no :06 Enter fee :10,000
Enter name :Swati Sadhana Enter f_name :R.K.Singh Enter roll_no :12 Enter fee :10,000
|
Responses
|
| Author: Prasad 18 May 2008 | Member Level: Gold Points : 2 | Thank you for this program
|
|
Watch TV Channels
|