tempstring is a character array :
char tempstring[1000];
dunno what other code u really need, but here is the whole load function:
Code:
int load()
{
char tempstring[1000] = ""; //the data gathered from the file
// certain key symbols used in the computation
char semicolon[16] = ";" ;
char comma[16] = "," ;
// character number in the tempstring being compared
int charnum = 0;
int charnum2 = 0; //end of word
ifstream lmdb("dataen.sdt"); //load mini database
cout << "Loading, please wait\n\n";
//load the file into a string
lmdb >> tempstring;
cout << tempstring; /*this is where i can see that tempstring isn't getting all the info */
i don't think anything beyond this point is relevant, but....
Code:
//unencrypt
for (int i = 0; i < strlen(tempstring); i++)
{tempstring[i] = encrypt (1, tempstring[i], enkey);}
charnum = lookfor (tempstring, 0, semicolon[0]);
// following is new load system for ndn
ndn = (int)tempstring[charnum - 1];
// Now lets get the info
int count = 0;
for (int i = 0; i < ndn ; i++)
{
dbe1[i].memID = i;
charnum = lookfor(tempstring, charnum2, semicolon[0]);
charnum++; //get it to the next character
charnum2 = lookfor(tempstring, charnum, comma[0]);
getdata (dbe1[i].firstName, tempstring, charnum, (charnum2 - 1));
charnum = ++charnum2;
charnum2 = lookfor(tempstring, charnum, comma[0]);
getdata (dbe1[i].lastName, tempstring, charnum, (charnum2 - 1));
charnum = ++charnum2;
charnum2 = lookfor(tempstring, charnum, comma[0]);
getdata (dbe1[i].nickName, tempstring, charnum, (charnum2 - 1));
}
return 0 ;
}
As you can see, very newbie code style, also not sure how to check if load was successful, bit of a newb, sorry . If you have any other suggestions as to how change things for the better i would also appreciate them (intrigued by how char pointers can be used in place of arrays?)
Hope this helps (helps me really, but anyway)
Thanks again.