It is similar to the exact I will post the exact code but it should be equal to the modifided code.
I didn't think so, because new uses malloc anyway.
It saves memory that is in a textbox instead of the data stored in the varibles.
Yes it is true my use of fwrite was a bit odd I forgot to return it to its right full form after I was messing with it. It just multiplies those two values together any way if my experences are correct so it shouldn't technicnically matter, but I have returned it to its proper form.
...{if (SaveDialog1->Execute()){CreatureLOAD *contatiner;contatiner=new CreatureLOAD[Memo2->Lines->Count/10];for (int x=0; x< Memo2->Lines->Count/10; x++){strcpy(contatiner[x].name,Memo2->Lines->Strings[x*10].c_str());strcpy(contatiner[x].desc,Memo2->Lines->Strings[(x*10)+1].c_str());contatiner[x].lvl=StrToInt(Memo2->Lines->Strings[(x*10)+2].c_str());contatiner[x].HP=StrToInt(Memo2->Lines->Strings[(x*10)+3].c_str());contatiner[x].ARTYPE=StrToInt(Memo2->Lines->Strings[(x*10)+4].c_str());contatiner[x].defencepower=StrToInt(Memo2->Lines->Strings[(x*10)+5].c_str());contatiner[x].DMGTYPE=StrToInt(Memo2->Lines->Strings[(x*10)+6].c_str());contatiner[x].attackpower=StrToInt(Memo2->Lines->Strings[(x*10)+7].c_str());contatiner[x].CARDNUMBER=StrToInt(Memo2->Lines->Strings[(x*10)+8].c_str());// line 9 is pointless, don't even look at it.}FILE *dat=NULL;dat = fopen(SaveDialog1->FileName.c_str(),"wb");BYTE temp=Memo2->Lines->Count/10;fwrite(&temp,sizeof(BYTE),1,dat);fwrite(contatiner,sizeof(CreatureLOAD),(Memo2->Lines->Count/10),dat);fclose(dat);}}...
[edited by - Xero-X2 on March 6, 2003 4:14:41 PM]