在C++中还可以传递引用:
void GetDateTimeStr(TDateTime Source, AnsiString &DateStr, AnsiString &TimeStr)
{
DateStr = FormatDateTime("yyyy'年'm'月'd'日'", Source);
TimeStr = FormatDateTime("hh'时'm'分'ss'秒'", Source);
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
AnsiString aDate, aTime;
GetDateTimeStr(Now(), aDate, aTime);
ShowMessage(aDate + "," + aTime);
}