#include "otk_lib/otk_lib.c" char directory[999]=".", wildcards[999]="", filename[999]=""; void my_file_answer( char *filename ) /* Print name of selected file. */ { printf("Browsing returned file-name: '%s'\n", filename ); } void browsetest() /* Invoke the File Selection Browser. */ { Otk_Browse_Files( "File to Open:", 999, directory, wildcards, filename, my_file_answer ); } main( int argc, char **argv ) { OtkInitWindow( 620, 540, argc, argv ); /* Open a window. */ OtkMakeButton( OtkOuterWindow, 20.0, 40.0, 60.0, 20.0, "Select File(s)", browsetest, 0 ); OtkMainLoop(); } |
To download this example, right-click: fbrowse.c.
To compile: cc -I/usr/X11R6/include -L/usr/X11R6/lib fbrowse.c -lGLU -lGL -lXmu -lXext -lX11 -lm -o fbrowse.exe
For information about the file browser widget, see: File Selection Browser Widget.