Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning array of strings

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
I like to declare a function that splits up a string of 64 chars, to 8 substrings of each 8 chars.

how do i declare such a function that it returns a pointer to my CString[8] and i can read the values from CString[1]..CString[8] ?

thanks
 
You may find it easier to use a vector instead of a regular array, pass the string in as paramter and return the vector at the end of the function:[tt]

std::vector MyFunction(CString str)
{
std::vector<CString> myVector;
// split the string into 8 parts
// and stuff each part into vector
// using the push_pack() method.

return myVector;
}
tellis.gif

programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top