Duncan:
>> Be aware that if you need trailing [non-option] arguments, such as
>> filenames, that you need to put an explicit '--' in the command line.
>>
>> ./flApp [options handled by args()] -- file1 file2 file3 ...
>>
>> I always forget the '--', and then wonder why I get an error message
Asif:
> I am sure if I understand your point but I am doing just fine with
> the argc and argv that I get from main(). I do that before I do
> anything related with FLTK.
I'm afraid that I replied without thinking, and confused things.
I hope that's clear from the later discussions with Ian.
As Ian pointed out, the simplest command line handling is probably
something like the following:
#include <stdio.h>
#include <FL/Fl.H>
int main(int argc, char* argv[])
{
int argsUsed;
if (!Fl::args(argc, argv, argsUsed))
Fl::fatal(Fl::help);
while (argsUsed < argc)
printf("argv[%d] = '%s'\n", argsUsed, argv[argsUsed++]);
return 0;
}
The code above, or something like it, should probably be added to
the Fl::args() documentation, or as a comment in the example code.
The examples/howto-parse-opts.cxx shows you the sort of thing you
need to do if you want to add your own command line switches that
start with '-'
Cheers
Duncan
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk