C Program to Read and Write to a File
Program:
#include<stdio.h> #include<conio.h> void main() { char sk; FILE *sp; sp=fopen("SAMPLE.TXT","w"); clrscr(); printf("Type the text press the enter key at end.\n"); while(sk=getchar())!='\n') putc(sk,sp); fclose(sp); }
Output:
Type the text and press the enter key at the end.
C Programming is one of the most powerful programming languages,
C Programming was developed by Dennis Ritchie at Bell Laboratories in 1970.