使用队列squeue出错,CString temp = ((CString)filenames.front()).Replace(_T(".bmp"),_T(".jpeg"));

来源:百度知道 编辑:UC知道 时间:2024/06/30 08:25:45
queue<CString> filenames;

while ( filenames.empty() == FALSE )
{
int a = filenames.front();
CString temp = ((CString)filenames.front()).Replace(_T(".bmp"),_T(".jpeg"));
BMP2JPG(filenames.front(),temp).
}

error C2440: 'initializing' : cannot convert from 'ATL::CStringT<BaseType,StringTraits>' to 'int'
1> with
怎么获取队列头的CString? 谢谢。

filenames.front() 返回的是一个 CString 的引用,不能强制转换为 int.

for(int nIndex = 0; filenames.size() > 0; nIndex++)
{
CString& temp = filenames.front();
filenames.pop();
temp.Replace(_T(".bmp"), _T(".jpeg"));
BMP2JPG(nIndex, temp);
}