opening a file in my VC++ application-Collection of common programming errors
.png)
msdn Hi ,i am new to VC++.now i want to open a .xml file in my application.if i opened it,others should not be able to open it.i gave the following code,but it is showing error at runtime.LPOFSTRUCT pStruct;
HFILE hh;
hh=OpenFile(“new.xml”,pStruct,OF_SHARE_DENY_WRITE);help me to solve it please….
.png)
msdn1 I think you are looking at the wrong function, see link:
http://msdn.microsoft.com/en-us/library/bb540534(VS.85).aspxHANDLE hFile = CreateFile(_T(“my.xml”),GENERIC_READ,0,NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { printf(“Failed to open file\n”); } else { // do reading.. CloseHandle(hFile); } iv
.png)
msdn2 hithank you…i”l check it….
Regards, L.Tony