Sunday, 29 January 2012

Program Of File Open Opreations In C


#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
clrscr();
FILE *fp;
fp=fopen("Vikas.txt","w");
char a[80];
while(strlen(gets(a))>0)
{
fputs(a,fp);
fputs("\n",fp);
}
getch();
}
------------------------------------------------------------------------
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
FILE *fp;
fp=fopen("Vikas.txt","w");
char a[80];
while(strlen(gets(a))>0)
{
fputs(a,fp);
fputs("\n",fp);
}
getch();
}

--------------------------------------------------------------------------

Opens the file whose name is specified in the parameter filename and associates it with a stream that can be identified in future operations by the FILE object whose pointer is returned. The operations that are allowed on the stream and how these are performed are defined by the mode parameter.
The running environment supports at least FOPEN_MAX files open simultaneously; FOPEN_MAX is a macro constant defined in <cstdio>.

No comments:

Post a Comment