有关CString的问题
下面一段代码:
GetSystemTime(&st1);
strDate.Format("%4d-%2d-%2d",st1.wYear,st1.wMonth,st1.wDay);
strTime.Format("%2d:%2d:%2d:%3d",st1.wHour,st1.wMinute,st1.wSecond,st1.wMilliseconds);
strName=strDate+strTime+".jpg";
// if(iter == params.end()) params["-out"] = "AV_Image1.jpg";
if(iter == params.end()) params["-out"] = strName;
……
std::ofstream fout(params["-out"].c_str(), std::ios_base::binary);
if(!fout)
MessageBox("could not be opened");
else
{
for(i = 0; i < iBufferSize; i++)
fout << pcImageBuffer[i];
if(!fout != true)
{
MessageBox("\image saved to file: ");
fout.close();
}
}
这段程序,
如果用现在被注释的那条代码,就可以顺利的输出结果,但是如果用没有注释的那一条,就会弹出MessageBox("could not be opened");请问是为什么呢?