#include <stdlib.h>
#include <iostream>
#include <string.h>
using namespace std;

void save();
void load();

struct casa{
int num;
char indirizzo[40];
};

int main(){
save();
load();

system("PAUSE");
}

void save(){
struct casa c;

c.num = 23;
strcpy(c.indirizzo,"Via Trionfale");

FILE *f;

f = fopen("indirizzo.txt","w"); //"w" specifica che il file è aperto in scittura

fwrite(&c, sizeof(c),1, f);

fclose(f);
}

void load(){
struct casa c;
FILE *f;
f = fopen("indirizzo.txt","r"); //"r" == file apperto in lettura

fread(&c, sizeof(c),1, f);
fclose(f);

cout << "Abiti in: " << c.indirizzo << " n." << c.num << "\n\n";
}

mi da 8 errori,dice anche che ci sono alcuni file non dichiarati