~cpp #include <iostream> using namespace std; struct Person{ char name[10]; int age; char phone[20]; }; int main() { Person p; cout << "Input name : " ; cin >> p.name; cout << endl << "Input age : "; cin >> p.age; cout << endl << "Input phone number : " ; cin >> p.phone; cout << p.name << p.age << p.phone ; system("pause"); FILE *fpt; fpt = fopen("struct.txt" , "wb"); //fread(&p, sizeof(Person), 1 , fpt); // (주소, 구조체 크기, 구조체 개수, 파일 ) fwrite(&p, sizeof(Person), 1, fpt); fclose(fpt); FILE *fp; fp = fopen("struct.txt", "rb"); fread(&p, sizeof(Person), 1, fp); fclose(fp); return 0; }