i have these code for save a structure data to a file and then read it:
struct user
{
string name;
image foto;
string adress;
int age;
};
user usrName={"joaquim",image("C:\\Nova pasta\\acrobat.bmp"), "viseu",32};
user usrName2;
FILE* f = fopen("C:\\Nova pasta\\username1.dat", "w+b");
if(f==NULL)
DebugText("error");
fwrite(&usrName, sizeof( user), 1, f);
fseek(f, 0, SEEK_SET);
fread(&usrName2, sizeof(user), 1, f);
fclose(f);
img=usrName2.foto;
only when i end the program, i get, sometimes, a memory leak.
what you can tell me?
(image is my image class, for working with images)