I would like to ask if someone here tried a function on VC++ that returns multiple data or values. I would like to store values after i tokenize a string. Example value is 00:00-10:00,11:00-14:00,16:00-21:00. As you can see, time are separated on 3 parts separated by a comma (,). Using strtok, i can separate the string.
char *token = strtok(stringabove,",");
while(token)
{
separatedvalues = token;
token = strtok(NULL,",");
}
return(separatedvalues);
code using vector.
vector<CString> MyFunction::Scheduler(CString value)
{
char temp[250];
sprintf(temp,"%s",value);
vector<CString> result;
char *token = strtok(temp,",");
while(token)
{
result.push(token;
token = strtok(NULL,",");
}
return(result);
}
I hope someone can help me with this one.
Thank you very much.