I am trying to open a text file. if the file does not exists, then it must be first created and opened.
I have written the following piece of code for this purpose. The code works fine, it also creates file inside BIN folder but still I cannot see any file get opened when I exexute this code.
Please tell what is wrong with my code.
using namespace std;
int WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd )
DWORD dwBytesRead, dwBytesWritten, dwPos;
hFile = CreateFile (("File.txt"),
if (hFile == INVALID_HANDLE_VALUE)
wsprintf (szMsg, TEXT("Could not open File.txt"));