|
CListCtrl数据不显示,并报错,帮忙给看看
[复制链接]
代码:
int index=0;
TCHAR* buffer,ptr;
LV_ITEM item;
int idItem;
buffer = new TCHAR[32];
FILE* inFile = _wfopen(strInFile, L"rb");
while(_fgetts(buffer, 32, inFile) && index<=30)
{
int len = _tcslen(buffer);
if (buffer[len - 1] == _T('\n'))
buffer[--len] = 0;
idItem = m_clDlist.InsertItem(index, L"")
item.iItem = idItem;
item.mask = LVIF_TEXT;
ptr = wcschr(buffer,'\t');
*ptr = '\0';
item.iSubItem = 1;
item.pszText = buffer;
m_clDlist.SetItem(&item);
buffer = ptr + 1;
ptr = wcschr(buffer,'\t');
*ptr = '\0';
item.iSubItem = 2;
item.pszText =buffer;
m_clDlist.SetItem(&item);
buffer = ptr + 1;
ptr = wcschr(buffer,'\t');
*ptr = '\0';
item.iSubItem = 3;
item.pszText = buffer;
m_clDlist.SetItem(&item);
buffer = ptr + 1;
item.iSubItem = 4;
item.pszText = buffer;
m_clDlist.SetItem(&item);
index++;
}
fclose(inFile);
文件能正常打开和关闭,报错:File Winctrl2.cpp,line 557。忽视后,ListCtrl不显示数据。
帮忙看看是什么原因,多谢!
|
|