The issue I have is with my conversion. The string variable numStr seems to be concatenating with the next item number each time. I'm not that familiar with this conversion method, so it may be my lack of understanding of it. I was hoping someone could tell me why it is doing this and suggest how to fix it.
Here is the output for cout << numStr << endl;:
3310
33101090
331010908100
3310109081003390
33101090810033906190
331010908100339061901360
3310109081003390619013609561
33101090810033906190136095616571
331010908100339061901360956165715211
3310109081003390619013609561657152119651
33101090810033906190136095616571521196517381
and so on...
convert << ary[i].itemNum;
This line means "add ary[i].itemNum" to whatever is already in the stringstream, so you're right in that it concatenates with what's already in the buffer. Just do this:
1 2
convert.str(""); //clear previous item number
convert << ary[i].itemNum; //proceed as usual