我对 C++ 和 Lotus 笔记了解不多。我有一段代码在日志中打印组名。
Util::AgentDebug("In Command::InitGroupMap(): Group Name = %s",lnGrpName.GetBuf());
lnGrpName 是 LN 字符串。它工作正常,但只要组名长度超过 2200,它就会崩溃。
这是示例 - 假设组名是
asd.Storage.Implementation;任务-mncpohcpg01;任务-paersc2hcpg01;azscotns02a; azscotns02b; ctshelns02a; ctshelns02b; flschons03a; flschons03b; iadubqns02a; iadubqns02b;mnncpoba0015; mnncpobrcd01; mnncpoisobrcd01; mnncpoisobrcd02; mnncpoisov7k01; mnncpolto01; mnncpolto01_1;mnncpolto01_imc;mnncpons03a; mnncpons03b; mnncpons900a_asd; mnncpons900b_asd; mnncpons900c; mnncpons900c_asd; mnncpons900d; mnncpons900d_asd; mnncpons900_asd; mnncpons900_sw1;mnncpons900_sw2; mnncposanc100;mnncposanc200; mnncposanr150; mnncposanr250;mnncposvc01; MNNCPOFL9KR01; MNNCPOFL9KR02; MNNCPONS900_sw1;MNNCPONS900_sw2;njmadins01a;njmadins01b;njros1ns05ta; njros1ns05tb; njwoodns05a; njwoodns05b; NJCTMVSP01;p2erscba0145; paersc1ns900a_asd; paersc1ns900b_asd; paersc1ns900c; paersc1ns900d; paersc1ns900_sw1;paersc1ns900_sw2; paersc2ns900a_asd; paersc2ns900b_asd; paersc2ns900c; paersc2ns900d; paersc2ns900_sw1; paersc2ns900_sw2; paersc2ocum01; paersc2opm01; paerscns05; paerscnsv501a;paerscnsv501b;PACTMVSP01; PAERSC1FL9KR01; PAERSC1FL9KR02; PAERSC1LABBRCD01; PAERSC1LABBRCD02; PAERSC1LABSVC01; PAERSC2FL9KR01; PAERSC2FL9KR02; PAERSC2FL9KR03; PAERSC2LABBRCD01; PAERSC2LABBRCD02; PAERSC2LABSVC01; txdalns02a;txdalns02b;MNNCPOBA0014; 文件csvc03;njros1svc01; njros1svc02; p1ehowld202; p1ehowld203; p2ehowld202; p2ehowld203; mncpold202; mncpold203; MNNCPONS805_asd; MNNCPONS805a_asd; MNNCPONS805b_asd; MNNCPONS805b_asd; paersc2ns805_asd; paersc2ns805a_asd; paersc2ns805b_asd; mncpob15k01; paersc1g15k01; paersc2g15k01; paersc2sane103; paersc2sane203; P2ERSCBA0305; MNNCPOBA0277; P2ERSCAPL0005; MNCPOAPL0016; p2erscba0147; mnncpoba0016; MNCPOECSCN01; PAERSC2ECSCN01; PAERSC2FLAR900_1;P2ERSCAPL0006; njros1labcisc100;njros1labcisc200;p1erscba0402; paersc2ns700_sw1; paersc2ns700_sw2; paersc2ns700a_asd; paersc2ns700b_asd; paersc2ns700_asd; paersc1ns700_sw1;paersc1ns700_sw2; paersc1ns700a_asd; paersc1ns700b_asd; paersc1ns700_asd; mnncpons700_sw1;mnncpons700_sw1;mnncpons700_sw2; mnncpons700a_asd; mnncpons700b_asd; mnncpons700c_asd; mnncpons700d_asd; mnncpons700_asd; p2erscba0346; p2erscba0146; paersc1ns500; paersc1ns500a_asd; paersc1ns500b_asd; paersc2ns500;paersc2ns500a_asd; paersc2ns500b_asd mnncpons700_asd; p2erscba0346; p2erscba0146; paersc1ns500; paersc1ns500a_asd; paersc1ns500b_asd; paersc2ns500;paersc2ns500a_asd; paersc2ns500b_asd mnncpons700_asd; p2erscba0346; p2erscba0146; paersc1ns500; paersc1ns500a_asd; paersc1ns500b_asd; paersc2ns500;paersc2ns500a_asd; paersc2ns500b_asd
这个问题是因为 LNString 还是 GetBuf()?
AgentDebug 方法如下 -
void Util::AgentDebug( wchar_t * format , ... )
{
wchar_t tmp[2048];
va_list args;
char strBuff[4096];
int j = 0;
va_start(args, format);
vswprintf_s(tmp, format, args);
va_end(args);
int cnt = wcstombs(strBuff, tmp, 4095);
if(cnt < 0)
{
char *strInput = (char*)tmp;
for( int i = 0; i < (wcslen(tmp) * 2); i++ )
{
if(strInput[i] != 0)
strBuff[j++] = strInput[i];
}
strBuff[j] = '\0';
}
// AdkDebug (strBuff);
// Fix for IY98698 Certain Chinese character throws exception during recon (PMR10927999672)
// String to be logged is passed as second argument
AdkDebug("%s",strBuff);
}// end of func AgentDebug()
// end S15302
有什么替代方法,因为我想在日志中打印组名。