FPRINTF Saving Datas in File Using C Programming


#include<stdio.h>
#include<conio.h>
void main()
{
   FILE *f;
   int a[100],b[100],n,i;
   char str[100][100];
   clrscr();
   f=fopen("tjs.c","w");
   if(f==NULL)
   {
     printf("\nUnable to create ..");
     exit();
   }
    printf("\nEnter the LImit :");
    scanf("%d",&n);
   for(i=0;i<n;i++)
   {
       printf("\nEnter the name :");
       scanf("%s",str[i]);
       printf("\nEnter the IDno :");
       scanf("%d",&a[i]);
       printf("\nEnter the salary :");
       scanf("%d",&b[i]);
       fprintf(f,"\nName   : %s",str[i]);
       fprintf(f,"\nIDno   : %d",a[i]);
       fprintf(f,"\nSalary : %d",b[i]);
   }
   fclose(f);
   getch();
}

Login To Download Source Code

Leave a Comment:

Login To Comment

List Of Programs


Goto Examples

Operators

Looping

Number Conversion

Pattern Design

Arrays

Matrix Examples

Sorting Examples

String Function

Change Case

String In C

Maths Functions

User Defined Functions

Recursive Functions

Pointer

Structure

File Concept

Calender Programming