Code:
void _open(Fl_Widget *f, void *)
{
FILE *fptr = new FILE;
char *flch;//[80];
char *flch2 = new char;
fb = new Fl_File_Chooser("HTML", NULL, 0, NULL);
fb->show();
while(fb->visible())
Fl::wait();
fptr = fopen(fb->value(), "rb");
while(!feof(fptr))
{
fgets(flch, NULL, fptr);//fread(flch, NULL, NULL, fptr);
sprintf(flch2, "%s\n%s", stktextbuffer->text(),flch);
stktextbuffer->text(flch2);
}
fclose(fptr);
}
There's the code, here's the problem. I've tried doing this many ways, but I can only open one file before the program crashes. If I open a file and it reads it, and click the open button again and choose another file, it crashes. I know this doesn't work with how I have it setup, but could someone help me with this. I've tried a lot of different things. Thanx - if you need all the source lemme know.