Dear all,
i ;m writing smart device c++ applcation, and here is the code:
however the line added in the detailvalue listbox is empty line, does anyone can point out what's wrong with that?Code:HANDLE hFile = CreateFile (L"\\Temp\\text.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0,NULL); if (hFile == INVALID_HANDLE_VALUE) { DWORD dw = GetLastError (); } else { DWORD dwRead = 0; DWORD dwSize = GetFileSize (hFile, NULL); if (dwSize == -1) //;//Protokoll(LOG_ERROR, 0, "GetFileSize () fehlgeschlagen"); else if (dwSize == 0) //;//Protokoll(LOG_ERROR, 0, "Die Datei ist leer"); else { dwSize = MAX_PATH; char szFile[MAX_PATH] = "\0"; ::ReadFile (hFile, szFile, dwSize, &dwRead, NULL); wchar_t szFile2[MAX_PATH] = L"\0"; mbstowcs(szFile2,szFile,strlen(szFile)+1); detailvalue.AddString(szFile2); CloseHandle(hFile); }
thanks



LinkBack URL
About LinkBacks



