RUPAK SEARCH ENGINE

Custom Search

Write a program to display names from a data file.

Write a program to display names from a data file.
#include
#include
#include
#include
#define NULL 0
# define spac " "
void main()
{
FILE *ptr;
char c;
int i=0,j;
clrscr();
if((ptr=fopen("myfile.dat","r"))==NULL)
printf("File not found.");
else
do
{
c=getc(ptr);
if(c==',')
putchar('\n');
else
putchar(c);
if(c==' ')
j++;
i++;
}while(feof(ptr)==0);
fclose(ptr);
getch();
}

No comments:

Post a Comment