RUPAK SEARCH ENGINE

Custom Search

Write a program to read one line text from a data file.

//Write a program to read one line text from a data file.
#include
#include
#include
#define NULL 0
void main()
{
FILE *ptr;
char c;
clrscr();
if((ptr=fopen("myfile.dat","r"))==NULL)
printf("File not found.");
else
do
putchar(c=getc(ptr));
while(c!='\n');
fclose(ptr);
getch();
}

No comments:

Post a Comment