[Insight-users] FLTK: fl_file_chooser ??

Luis Ibanez luis . ibanez at kitware . com
Thu, 07 Aug 2003 12:00:25 -0400


Hi Zein,

Ah!
the beauty of reading the documentation:

http://www . fltk . org/doc-1 . 1/functions . html#fl_file_chooser2

"...The returned value points at a static buffer that
  is only good until the next time fl_file_chooser()
  is called."

------

You may want to do something like

std::string filename1 = fl_file_chooser(...
std::string filename2 = fl_file_chooser(...
std::string filename3 = fl_file_chooser(...

So the actual strings gets copied into a std::string
instead of just being held by a const char *.

Note that there is a new class Fl_File_Chooser
that is probably better than using the fl_file_chooser
function.



Regards,


     Luis


----------------
salah wrote:
> Hello,
> 
> I am calling fl_file_chooser  three times to choose three file name
> at the beginning of my program. I amwriting this code
> 
>   char *fName_Image = fl_file_chooser("Choose Input Image File", "*.mh*", "d:/data/");
>    char *fName_Seg =   fl_file_chooser("Choose Segmented Image File", "*.mh*", "d:/data/");
>    char *fName_Bone =  fl_file_chooser("Choose Bone Image File", "*.mh*", "d:/data/");
> 
> when the program runs, the file chooser window appear three times 
> I choose three different files. The strange thing is that all the three 
> variable ( fName_Image, fName_Seg, and fName_Bone) finally 
> have the same value, which is the name of the last chosen file!!
> 
> Could somebody please guess what is going on?
> 
> Thanks,
> 
> Zein
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk . org
> http://www . itk . org/mailman/listinfo/insight-users
>