I have a console C++ application that reads standard input and writes standard output. I want to run (i.e., debug) the program under the IDE, using a text file that I want to redirect to the program, and want the output to redirect to (over)write a text file.
Going to the project properties, and under "Comand Arguments" typing
"<in.txt>out.txt" (without the quotes) does not work. Neither does
like in title described i have this problem!
That because, if i click in my CListCtrl i try to find what is the text in this cell!
I do it now like this:
// in this way i don't receive my text:
LPNMLISTVIEW lpItem = (LPNMLISTVIEW)pNMHDR;
lvItem.mask = LVIF_TEXT;
lvItem.iItem = lpItem->iItem;
lvItem.iSubItem = lpItem->iSubItem;
// but lvItem.pszText is empty, or not readable content :(// this works(but why not the sample above with LVITEM?):
csIndex = m_cListAll.GetItemText(lpItem->iItem, 0);
csItemText= m_cListAll.GetItemText(lpItem->iItem, 1);
Why not use the code that works? If you're using MFC, let MFC do the work.
You can also trace into the working code and see how it differs from your code.
Back to your broken code...
The docs for LVM_GETITEM state:
"If the LVIF_TEXT flag is set in the mask member of the LVITEM structure,
the pszText member must point to a valid buffer and the cchTextMax member
must be set to the number of characters in that buffer. Applications should
not assume that the text will necessarily be placed in the specified buffer.
The control may instead change the pszText member of the structure to point
to the new text rather than place it in the buffer."