/*
FILE
Ghi van ban vao file su dung fputc(FILE)
Doc van ban tu file su dung fgetc(FILE)
*/
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef char Xau[200];
void main(){
FILE *f;
Xau s;
int i=0;
clrscr();
//mo file de ghi. Neu chua co se tao
f=fopen("textdata82.dat", "w");
printf(" Hay nhap 1 xau: ");
gets(s);
while(i<strlen(s)){
fputc(s[i], f);
i++;
}
fclose(f);//dong file
//mo file de doc
f=fopen("textdata82.dat", "r");
if (f!=NULL){
while(!feof(f)){
char c= fgetc(f);
printf("%c", c);
}
}
else
printf("ERROR");
fclose(f);
getch();
}