convert BSTR to LPSTR?
-
Hi. I am using a listview in a win32 api application... I want to set the text of the listview item. I do this: // LvItem.pszText= (LPSTR)_bstr_t(RsITEM(pSet,"FILE_NAME")); // it displays some junk characters... The listview works normally and there isnt any problem with the database nor with the data collection (made with RsITEM(pSet,"FILE_NAME") ) ... Thank you very much in advance for your answers... Well... I am a beginner ...
-
Hi. I am using a listview in a win32 api application... I want to set the text of the listview item. I do this: // LvItem.pszText= (LPSTR)_bstr_t(RsITEM(pSet,"FILE_NAME")); // it displays some junk characters... The listview works normally and there isnt any problem with the database nor with the data collection (made with RsITEM(pSet,"FILE_NAME") ) ... Thank you very much in advance for your answers... Well... I am a beginner ...
You can't simply cast a BSTR to LPSTR because they are different formats. Try using one of ATL conversion macros
LvItem.pszText = OLE2T(_bstr_t(RsITEM(pSet,"FILE_NAME")));
Or assign the BSTR to a CString, which will do the conversion for you
CString sAux = _bstr_t(RsITEM(pSet,"FILE_NAME"));
LvItem.pszText = sAux;Hope that helps, -- jlr http://jlamas.blogspot.com/[^]
-
You can't simply cast a BSTR to LPSTR because they are different formats. Try using one of ATL conversion macros
LvItem.pszText = OLE2T(_bstr_t(RsITEM(pSet,"FILE_NAME")));
Or assign the BSTR to a CString, which will do the conversion for you
CString sAux = _bstr_t(RsITEM(pSet,"FILE_NAME"));
LvItem.pszText = sAux;Hope that helps, -- jlr http://jlamas.blogspot.com/[^]