Hi! I've been searching for a bit of code that will allow me to set the size of an item in a vector. This is what I've come up with - its a portion of the code in my class. Will this work? or will the size automatically resize if a larger string is typed in by a user?
void item::setItName(string itNameValue)
//copy up to 14 chars for item name
itName = itNameValue;
int length = itNameString.size();
length = (length < 14 ? length : 13);
itNameString.copy ("", length);
itName[length] = '\0'; //append null character to vendor
}//end function setitName
Thats exactly what I need to do, I seem to have a real problem complicating things. I read something about this feature in C++ that stated even if you set this, if a user types in a longer string, it will resize to that string. Is this true?