scanf from script called by button

Richard Hasty (rhasty@io.com)
Thu, 28 May 1998 17:08:16 -0500 (CDT)


Well I'm repeating myself exactly, but I'll try again.

I'm trying to write some simple scripts that can be called using a button,
but the scripts need some input. The scripts below illustrate the problem.
THe read and print script works perfectly when called with ".x
readtest.c", but when called from a button the string is not printed as
the user types, even though it seems to read the correct string. The
feedback is rather important while you are typing. I'm using version
2.00/07. Do you know of a way around this problem?

Thanks,
Richard Hasty
rhasty@io.com

buttontest.c

{
//Set up a button

// gROOT->Reset("a");
bar = new TControlBar("vertical", "SAMPLE");
bar->AddButton("Read", ".x readtest.c", "Read text");
bar->Show();
// gROOT->SaveContext();
}

readtest.c:

{
char test[80];

fprintf(stdout,"Read Junk:");
fscanf(stdin,"%s",test);
fprintf(stdout,"%s\n",test);
}