Shahzad Alam
April 14th, 1999, 08:23 AM
I am passing any array of COleDateTime to a fuction to perform some operatios. But the array is not passed except for the first entry and even gives an exception when the function return value.
My code is:
// Before I call the function, initialize the time values
COleDateTime[5] time;
time[1].SetTime(6,0,0);
time[2].SetTime(10,0,0);
time[3].SetTime(14.0,0);
time[4].SetTime(20,0,0);
// calling function now to pass the time object
int value;
value = MyFunction(time);
*************************************
// Implementation of MyFuction
int MyFunction(COleDateTime *time)
{
CString str[5]; // just to convert time to CString and display
str[1]=time[1].Format("%H:%M:%S");
str[2]=time[2].Format("%H:%M:%S");
str[3]=time[3].Format("%H:%M:%S");
str[4]=time[4].Format("%H:%M:%S");
AfxMessageBox(str[1]);
AfxMessageBox(str[2]);
AfxMessageBox(str[3]);
AfxMessageBox(str[4]);
return 0; // just a test here!
}
This function does not display the 4 times but just the first one. Please help! How can I pass the array to the function correctly. This function generates an exception when it returns the value. Please help!
My code is:
// Before I call the function, initialize the time values
COleDateTime[5] time;
time[1].SetTime(6,0,0);
time[2].SetTime(10,0,0);
time[3].SetTime(14.0,0);
time[4].SetTime(20,0,0);
// calling function now to pass the time object
int value;
value = MyFunction(time);
*************************************
// Implementation of MyFuction
int MyFunction(COleDateTime *time)
{
CString str[5]; // just to convert time to CString and display
str[1]=time[1].Format("%H:%M:%S");
str[2]=time[2].Format("%H:%M:%S");
str[3]=time[3].Format("%H:%M:%S");
str[4]=time[4].Format("%H:%M:%S");
AfxMessageBox(str[1]);
AfxMessageBox(str[2]);
AfxMessageBox(str[3]);
AfxMessageBox(str[4]);
return 0; // just a test here!
}
This function does not display the 4 times but just the first one. Please help! How can I pass the array to the function correctly. This function generates an exception when it returns the value. Please help!