M
Mike Copeland
I have the following structure defined and declared, and I have
populated the list with 11 records (I watched them go in during debug.)
After building the list, I'm trying to write it out to a file...but I
only write 11 copies if the _first_object_instance_ - not the 11
different objects.
I know I'm doing something wrong here, but I'm unable to see what it
is. Please advise. TIA
struct Tandems
{
long tandemLink;
string teamMate;
} tandemWork;
typedef list<Tandems> TandemList;
TandemList tandemData;
list<TandemList>::iterator tandemIter;
....
Tandems tanWork; // local work variable
list<Tandems>::iterator xIter; // local iterator
for(xIter = tandemData.begin(); xIter != tandemData.end(); xIter++)
{
tanWork = (*xIter); // move list object to local variable
printf("%12d|%s", tanWork.tandemLink,
tanWork.teamMate.c_str());
// *** Always seeing the 1st stored object here! 8<{{
} // for
populated the list with 11 records (I watched them go in during debug.)
After building the list, I'm trying to write it out to a file...but I
only write 11 copies if the _first_object_instance_ - not the 11
different objects.
I know I'm doing something wrong here, but I'm unable to see what it
is. Please advise. TIA
struct Tandems
{
long tandemLink;
string teamMate;
} tandemWork;
typedef list<Tandems> TandemList;
TandemList tandemData;
list<TandemList>::iterator tandemIter;
....
Tandems tanWork; // local work variable
list<Tandems>::iterator xIter; // local iterator
for(xIter = tandemData.begin(); xIter != tandemData.end(); xIter++)
{
tanWork = (*xIter); // move list object to local variable
printf("%12d|%s", tanWork.tandemLink,
tanWork.teamMate.c_str());
// *** Always seeing the 1st stored object here! 8<{{
} // for