Created
July 30, 2018 13:21
-
-
Save mwallner/59a4b97762c564891cfddbb23385a4d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <afxstr.h> | |
#include <afx.h> | |
#define PATH_MAX 255 | |
BOOL determine_status(CString szPath) { | |
wprintf(L" > determine_status: %s\n", szPath); | |
WIN32_FIND_DATA findFileData; | |
if (INVALID_HANDLE_VALUE == FindFirstFile(szPath, &findFileData)) { | |
wprintf(L" > FindFirstFile failed!\n"); | |
} | |
TCHAR cwd[PATH_MAX]; | |
GetCurrentDirectory(PATH_MAX, cwd); | |
wprintf(L" > cwd: %s\n", cwd); | |
CFileStatus fs; | |
BOOL st = CFile::GetStatus(szPath, fs); // if we can get a status, it should exist | |
if (!st) { | |
DWORD err = GetLastError(); | |
wprintf(L" > last error: %d\n", err); | |
} else { | |
wprintf(L" > fs.m_szFullName: %s\n", fs.m_szFullName); | |
} | |
return st; | |
} | |
int main() | |
{ | |
if (determine_status(L"C:")) { | |
wprintf(L" SUCCESS\n"); | |
return 0; | |
} else { | |
wprintf(L" FAILURE\n"); | |
return 1; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment