How to write another Thread data in txt file?
-
Hello.
I want to write data from another thread in txt file.
Text files will be named currentTime() and created periodically every minute.
So, Txt file made very well every minute using QTimer, but In Txt file, content is null.
Of course this result is correct. Because i didn't connect data from another Thread.
How to connect or send data from another thread to QTimer make the txt file every minute?
For example, another thread get data every second and QTimer make txt file every minute.
Ideally, another thread get 60 data in minute and one text file made in minute.
I want to write 60 data to txt file one cycle. -
-
@jsulm Thanks for answer. this is another question. if i start qtimer like this
QTimer *timer = new QTimer(this) timer->start(60000);
the time start not now but one minute left.
I want to start QTimer now -> one minute -> one minute
but now code one minute -> one minute -> one minute.
How can I handle it? -
@duckrae said in How to write another Thread data in txt file?:
How can I handle it?
Simply emit the signal:
QTimer *timer = new QTimer(this) timer->start(60000); emit myTimeoutSignal(text);