PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

fopen

hi !
maybe someone can give me a hint.
how can i get the right filename?
with opendlg.GetFileName i get my file(test.dat),but for "fopen" i need const char !!
thanks


Code:
TCHAR szFilter[] = _T("DatFiles (*.dat)|*.dat||");

CFileDialog opendlg(TRUE, NULL,TEXT("\\My Documents") , OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT ,szFilter);
if (opendlg.DoModal() == IDOK)
{
CString filename = opendlg.GetFileName();
FILE *stream = fopen(filename, "r");
}
(Re)Read the answer Digby gave you for a previous question:

http://forums.pocketmatrix.com/viewtopic.php?t=9374

(Unless you really want cross-platform portability, use CreateFile to open the file rather than fopen).
Change line 7 to:

FILE *stream = _tfopen(filename, _T("r"));

Dan East
ITT · 27 Jan 2003, 18:39 UTC — fopen
thanks a lot Dan East!!