G
Gurunama
Guest
I have made a program in VS express 2010 with Windows 7 using _wfopen command, and which has been working fine. I have now transferred the program to VS Community 2019 with Windows 10, and some commands that previously gave a warning now give an error, among them _wfopen. I therefore switched to using _wfopen_s, but which I don't understand why doesn't work. The code is the following:
static FILE * licensefile;
static TCHAR userpath[MAX_PATH];
patherror = SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, SHGFP_TYPE_CURRENT, userpath);
error = PathAppend (userpath, TEXT("DhruvaNada\\gnsh.dat"));
hFile = CreateFile(userpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Errorcheck = _wfopen_s(&licensefile, userpath, L"r");
hFile do not give INVALID_HANDLE_VALUE.
Errorcheck gives the value 13, which should give "Permission denied".
Thanks in advance.
Sincerely
Continue reading...
static FILE * licensefile;
static TCHAR userpath[MAX_PATH];
patherror = SHGetFolderPath(0, CSIDL_COMMON_APPDATA, 0, SHGFP_TYPE_CURRENT, userpath);
error = PathAppend (userpath, TEXT("DhruvaNada\\gnsh.dat"));
hFile = CreateFile(userpath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |
FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Errorcheck = _wfopen_s(&licensefile, userpath, L"r");
hFile do not give INVALID_HANDLE_VALUE.
Errorcheck gives the value 13, which should give "Permission denied".
Thanks in advance.
Sincerely
Continue reading...