Macaw OS C reference

Function openfile

#include <macawui.h>
void openfile(
    void (*fn)(const char *path),
    const char *dir,
    const char **exts,
    int n
);

Shows the Open dialog, for the person to pick a file.

Parameters

fnvoid (*)(const char *path)
Your function, called with the whole path of the file they picked.
dirconst char *
The folder it starts in, from your program's folder unless it starts with /. NULL for /home.
extsconst char **
An array of n file endings it can open, without the dot, like { "pxl", "png" }. NULL for any file.
nint
How many endings are in exts. 0 for any file.

In Dialogs, with alert, confirm, askstring, savefile, pickcolour.