Unfortunately that doesn't quite work the way I need it to. I know how to do that, But I need each line to become assigned to a string. I was thinking something maybe like :
Originally Posted by 7stud
The problem with this code is that if i were to ever add more "items" to the .txt i would have to recompile the .exe with another item# variable. Is there a way of avoiding a situation like that?
string item1, item2, something;
void Stock::GetNames(char *file, int lines)
while((getline(productlist, something)) && (x<lines))
item1 = something;
item2 = something;
// I don't want to have to add more string variables
//than I absolutely have to.
return item1, item2;