Exp1: WAP to write and read a character W using file handling.

 

#include<stdio.h>

#include<conio.h>

void main()

{

FILE *f;

clrscr();

f = fopen("c:\\turboc3\\source\\temp2.txt","w");

fputc('W',f);

fclose(f);

f = fopen("c:\\users\\dr\\c_prog\\temp2.txt","r");

printf("%c",fgetc(f));

fclose(f);

getch();

}