CSTRING vs LPCSTR
Posted on 2003-03-06
I am new to C (as you will see by my question :-) and am having a fairly basic (I hope) problem.
I am using a FileDialog to select files and then am attempting to open them using CREATEFILE. But because GetNextPathName returns a CSTRING and CREATEFILE expects a LPCSTR, I get a compiler error.
Code snippet as per below.
I don't having any books to refer so would be greatful of any expert comments.
CFileDialog dlg(TRUE, _T("txt"), NULL,
OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT,
_T("All Files (*.*)|*.*||"));
if (dlg.DoModal() == IDOK)
// Process file
hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, 0, NULL);