C program which reads string from file.

source code


#include<stdio.h>
int main()
{
char str[70];
FILE *p;
if((p=fopen("string.txt","r"))==NULL){
printf("\nUnable t open file string.txt");
exit(1);
}
while(fgets(str,70,p)!=NULL)
puts(str);
fclose(p);
getch();
return 0;
}

Comments

Popular posts from this blog

C program for multiplication of two matrices.

String copy without using strcpy in C.

BIOS/DOS CALLS – DISK INFORMATION