Original Post
I'm having problems with a section of my code and I don't know why.. ThisAccount->Next should equal 0x00000000 but it doesn't, for some reason it equals 0x00006666 which makes my while loop run again ahich isn't what I want. Here's my AddAccount function too incase the problem is in there.
fstream Account;
Account.open("accounts.txt", ios::in);
Account >> NumAccounts;
for(unsigned int a = 0; a < NumAccounts; a++)
{
AddAccount();
}
ACNTSTRUCT* ThisAccount = FirstAccount;
while(ThisAccount != NULL)
{
Account >> ThisAccount->AcntLoginName;
Account >> ThisAccount->AcntPassword;
Account >> ThisAccount->AcntSerial;
AddString(CharToLPCWSTR(ThisAccount->AcntLoginName));
ThisAccount = ThisAccount->Next;
}
Account.close();
ACNTSTRUCT* AddAccount()
{
if(FirstAccount == NULL)
{
FirstAccount = new ACNTSTRUCT;
LastAccount = FirstAccount;
LastAccount->Next = NULL;
}
else
{
LastAccount->Next = new ACNTSTRUCT;
LastAccount = LastAccount->Next;
LastAccount->Next = NULL;
}
strcpy(LastAccount->AcntLoginName,"NONE");
strcpy(LastAccount->AcntPassword,"NONE");
strcpy(LastAccount->AcntSerial,"NONE");
return LastAccount;
}