Am 16.05.13 18:20, schrieb Pinnerite:
> At the point where the output file is prepared, I want both a data entry box
> for the user to enter or even edit a prototype filename and a dropdown
> directory listbox enabling the user to browse it in order to select their
> desired destination. I cannot remember the correct terminology for the
> widgets, sorry.
So you want a GUI to choose the pathnames from.
I second the proposal to make a wrapper approach, much more on Linux.
First, you should change the "C" program (let's call it foo-c) to accept
the output file names as command line args, such that you call it
./foo-c write_to_this.txt and-that.dat
That should be rather straightforward, simply replace the hardcoded file
names by argv[1], argv[2] etc.
Then, create a GUI wrapper using e.g. Tcl/Tk, which is preinstalled in
almost every Linux system. Something as simple as the following should
work, if you put it in the same directory as foo-c:
#!/usr/bin/env wish
#
package require Tk
# compute path to foo-c
set mydir [file dirname [info script]]
set fooc [file join $mydir foo-c]
# ask for file name
set fn [tk_getSaveFile -title "Choose file name" ]
if {$fn!=""} {
# user hit Save, run foo-c
exec $fooc $fn
}
exit
If you put this in a file and give execute permissino, it should work.
Of course, you can make it more fancy by adding a progress bar, multiple
options, better error handling and the like.
The beauty in this approach is, that you can still call the original
thing from the command line, and that crashes from the underlying
utility don't crash the GUI.
Christian