Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Photos B.Tech Projects New Member FAQ  



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.

website counter




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 2008Member Level: Gold   Points : 2
Thank you for this program


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: C Program to check number for prime , even or odd number
Previous Resource: C program to read and print the element of matrix using pointer
Return to Discussion Resource Index
Post New Resource
Category: Computer & Technology


Post resources and earn money!
 
Related Resources

Watch TV Channels



Contact Us    Editors    Privacy Policy    Terms Of Use   

SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.