
Newbie, help with function that returns two strings
Hi,
your question is not really
MFC related, better see comp.lang.c or
comp.lang.c++.
Anyway you should do something like :
void CPag1::RealName(CString FieldName, CString* pfName, CString* ptName)
{
int x=FieldName.Find('.',0);
int nRightLength=FieldName.GetLength()-x-1;
(*pfName) =FieldName.Right(nRightLength);
int nLeftLength=FieldName.GetLength()-nRightLength-1;
(*tName)=FieldName.Left(nLeftLength);
Quote:
}
then call it by doing :
CString FieldName=...;
CString fName;CString tName;
MyPag1.RealName(FieldName,&fName,&tName);
Hope this helps
Fabrice
Quote:
> Hi, sorry if this seems very stupid, I'm trying to create a function that
> returns two CStrings as result of the internal processing, I need to
obtain
> fName and tName.
> CString CPag1::RealName(CString FieldName)
> {
> int x=FieldName.Find('.',0);
> int nRightLength=FieldName.GetLength()-x-1;
> CString fName=FieldName.Right(nRightLength);
> int nLeftLength=FieldName.GetLength()-nRightLength-1;
> CString tName=FieldName.Left(nLeftLength);
> return fName;
> return tName;
> }
> Thanks and best regards.