C ++ Open File Dialog on Linux

I was wondering if anyone could help me implement a simple open open C ++ dialog in Ubuntu. I use OpenGL for my GUI, but I would like the user to be able to select a file when the program loads. I tried gtkmm and wxWidgets, but they seem too complicated for what I want to do.

+5
source share
2 answers

If you just need to select a file, run a separate program for this. As @ Dummy00001 said in a comment, you can run zenity --file-selection as a child process and read its standard output.

 char filename[1024]; FILE *f = popen("zenity --file-selection", "r"); fgets(filename, 1024, f); 

Or you can also write your own program to complete the task. Thus, you can customize the interface as you wish.

+3
source

I wrote osdialog for this purpose. See osdialog_gtk2.c for an example of using GTK + 2.

0
source

All Articles