Created
March 23, 2011 01:20
-
-
Save iwadon/882452 to your computer and use it in GitHub Desktop.
PathFindOnFile() sample.
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
| /* cl pfop_sample.c shlwapi.lib */ | |
| #include <stdio.h> | |
| #include <shlwapi.h> | |
| int main() | |
| { | |
| BOOL bOk; | |
| char buf[MAX_PATH] = {0}; | |
| /* (A) Set path as relative filename */ | |
| strcpy(buf, ".\\pfop_sample.exe"); | |
| bOk = PathFindOnPath(buf, NULL); | |
| printf("(A) bOk=%s\n", bOk ? "TRUE" : "FALSE"); /* => bOk=FALSE */ | |
| /* (B) Set separated path */ | |
| strcpy(buf, "pfop_sample.exe"); | |
| { | |
| const char *other_dirs[] = {".", NULL}; | |
| bOk = PathFindOnPath(buf, other_dirs); | |
| } | |
| printf("(B) bOk=%s\n", bOk ? "TRUE" : "FALSE"); /* => bOk=TRUE */ | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment