比如,我给出一个int p=2000;
我要将一个打开的文件另存为2000.bmp
大致代码如下:
void C***View::OnButtonSave()
{
         int p=2000;
         CString strCopyFileName;
strCopyFileName.Format("%d",p);
         CFile file;
CFileException fe;
         // 打开文件
if (!file.Open(LPCTSTR(strCopyFileName), CFile::modeCreate |
  CFile::modeReadWrite | CFile::shareExclusive, &fe))
{
// 失败
// 返回
return;
} // 尝试调用SaveDIB保存图像
BOOL bOpenSuccess = FALSE;
TRY
{
// 尝试保存图像
bOpenSuccess = ::SaveDIB(hDIB, file);// 保存hDIB是指向一幅位图的句柄 // 关闭文件
file.Close();
}
CATCH (CException, eSave)
{
// 失败
file.Abort();
// 返回
return;
}
END_CATCH
if (!bOpenSuccess)
{
// 保存失败,提示出错
MessageBox("无法保存BMP图像!");
}
}
运行以后,得到的是2000文件,无扩展名,不是位图文件
如果直接strCopyFileName="d:\\2000.bmp";
保存后就得到位图文件
请问,我该如何通过给出的整数p,让它保存为p.bmp文件?