you cannot do something like that. lname stores the address of 20 bytes of memory allocated for the array. the statement "name = readline->substr(8, 19);" attempts to change the address of lname to the value returned by substr().
Originally posted by gvector1
lname = readline->substr(8,19);
lname is declared as "char lname"
readline is the string that holds the line from the file
what you want to do is copy the string into the lname buffer:
std::string sub = readline->substr(8, 19);
strncpy(lname, sub.c_str(), sub.size());
lname[sub.size()] = NULL;