| #include <nfd.h> |
|
|
| #include <stdio.h> |
| #include <stdlib.h> |
|
|
| |
|
|
| int main(void) { |
| |
| |
| |
| NFD_Init(); |
|
|
| const nfdpathset_t* outPaths; |
|
|
| |
| nfdfilteritem_t filterItem[2] = {{"Source code", "c,cpp,cc"}, {"Headers", "h,hpp"}}; |
|
|
| |
| nfdresult_t result = NFD_OpenDialogMultiple(&outPaths, filterItem, 2, NULL); |
|
|
| if (result == NFD_OKAY) { |
| puts("Success!"); |
|
|
| |
| nfdpathsetenum_t enumerator; |
|
|
| NFD_PathSet_GetEnum(outPaths, &enumerator); |
| nfdchar_t* path; |
| unsigned i = 0; |
| while (NFD_PathSet_EnumNext(&enumerator, &path) && path) { |
| printf("Path %u: %s\n", i++, path); |
|
|
| |
| NFD_PathSet_FreePath(path); |
| } |
|
|
| |
| NFD_PathSet_FreeEnum(&enumerator); |
|
|
| |
| NFD_PathSet_Free(outPaths); |
| } else if (result == NFD_CANCEL) { |
| puts("User pressed cancel."); |
| } else { |
| printf("Error: %s\n", NFD_GetError()); |
| } |
|
|
| |
| NFD_Quit(); |
|
|
| return 0; |
| } |
|
|