Monday, 29 October 2012

Program Of GET PUT Function In C

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
 
main()
 
{
 
clrscr();
 
int i,a,m,n;
 
printf("Enter No. Of Char");
 
scanf("%d",&m);
 
printf("\n Contens Of Main File=");
 
for(i=1;i<=m;i++)
 
{
 
scanf("%d",&n);
 
if(n==-1)
 
break;
 
}
 
fclose(f1);
 
f1=fopen("Main","r");
 
f2=fopen("ODD","w");
 
f3=fopen("EVEN","w");
 
while(a!=EOF)
 
{
 
if(a%2==0)
 
{
 
}
 
else
 
{
putw(a,f2);
 
}
 
a=getw(f1);
 

fclose(f1);
 
fclose(f2);
 
fclose(f3);
 
f2=fopen("ODD","r");
 
f3=fopen("EVEN","r");
 
printf("Content of ODD File \n");
 

{
 
printf("%d\n",a);
 
}
 
printf("Content Of Even File\n ");
 
while(a=getw(f3)!=EOF)
 
{
 
printf("%d\n",a);
 
}
 
fclose(f2);
 
fclose(f3);
 
getch();
 
}

No comments:

Post a Comment