/*
FILE
Doc, ghi file nhi phan
*/
#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct{
char hoten[30];
int tuoi;
} Nguoi;
void main(){
Nguoi a, b;
FILE* f;
strcpy(a.hoten,"Nguyen Van Hoa");
a.tuoi=20;
//Mo file de ghi
f=fopen("binary.dat", "wb");
fwrite(&a, sizeof(a), 1, f);
fclose(f);
//Mo file de doc
f=fopen("binary.dat","rb");
fread(&b, sizeof(b), 1, f);
fclose(f);
printf("\n Ho ten: %s", b.hoten);
printf("\n Tuoi: %d", b.tuoi);
getch();
}