Returning an array of tm* structs from a function
- by paultop6
Hi Guys,
Im trying to create an array of tm* structs, and then return them at the end of the function. This is what i have at the moment:
struct tm* BusinessLogicLayer::GetNoResponceTime()
{
struct tm* time_v[3];
struct tm* time_save;
int s = 3;
time_save = LastSavedTime();
time_v[0] = time_save;
sleep(5);
time_save = LastSavedTime();
time_v[1] = time_save;
sleep(5);
time_save = LastSavedTime();
time_v[2] = time_save;
return time_v;
}
I understand that given the code i have now it will not be possible to return the array, because it will be destroyed when the function ends. Can anyone help me with regards to how i would go about being able to access the array from the returned value after the function has ended?
Regards
Paul