Original Post
This does not work.
This does work.
I can see that that means that the problem is useing the pointer to the stucture how can I fix this while still maintaining the dynamic array size?
thanks.
int SIZEOFARRAY=100; char *FileName; CreatureLOAD *contatiner; contatiner=new CreatureLOAD[SIZEOFARRAY]; ... <- FileName is set in here as well as the data is set. FILE *dat=NULL; dat = fopen(FileName,"wb"); BYTE temp=SIZEOFARRAY; fwrite(&temp,sizeof(BYTE),1,dat); fwrite(contatiner,sizeof(CreatureLOAD)*(SIZEOFARRAY),1,dat); fclose(dat);
int SIZEOFARRAY=100; char *FileName; CreatureLOAD contatiner[100]; ... <- FileName is set in here as well as the data is set. FILE *dat=NULL; dat = fopen(FileName,"wb"); BYTE temp=SIZEOFARRAY; fwrite(&temp,sizeof(BYTE),1,dat); fwrite(contatiner,sizeof(CreatureLOAD)*(SIZEOFARRAY),1,dat); fclose(dat);