|
-
February 6th, 2009, 02:57 PM
#1
Text File Writing
Want to write a text file to save log data during app runtime. Grabbed this code from MSDN itself, and it doesnt compile.
HANDLE hFile = CreateFile(_T("C:\\TEMP\\MyFile.txt"),
GENERIC_WRITE, FILE_SHARE_READ,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
AfxMessageBox(_T("Couldn't create the file!"));
else
{
CFile myFile(hFile);
static const char sz[] = "Hockey is best!";
myFile.Write(sz, lstrlen(sz));
myFile.Close();
}
This is the error
'lstrlenW' : cannot convert parameter 1 from 'const char [16]' to 'LPCWSTR'
What am I doing wrong?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|