Root doesn't start because of std::cin (with code)

Hello everyone,

I have an issue with a uni project. During the code, I make a plot canvas that works perfectly, showing a Fourier transformed graph with the frequencies, but then have to ask the user which frequencies he wants to cut away. This implies using a std::cin AFTER having launched the two Canvas, so when I execute the program this canvas is completely white until i do not cin these numbers. The problem is that those numbers depends on the plot (I have to see it!) How can I do?
The code is something like this:


[previous code]

float low_freq = 0;
float top_freq = 0;
std::cout << “Which range of frequencies would you like to cut?” << std::endl;
std::cout << "From (Hz): ";
std::cin >> low_freq; //THIS STOPS THE EXECUTION! WHITE CANVAS
std::cout << "To (Hz): ";
std::cin >> top_freq;
std::cout << std::endl;

[rest of the code]


The quesiton is: how can I make the plot be seen before typing input data? Because those frequency have nothing to do with the plot…

Thanks in advance! :grinning:


ROOT Version: 6.14/06
Platform: Linux pc
Compiler: Not Provided


Dear matteo.tajana,

What does it mean

?

Did you call canvas->Update() before std::in ?

G Ganis

Dear ganis, I tried but didn’t work. So I passed from a TApplication to a TThread and now the canvas are shown and can type anything. Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.