Message from C, C++ talks

July 2019

— I have no idea what Wall or right flag is. I would search about it . Thanks .

— Why am getting error to execute this statement in CPP


— Don't crosspost your question

— What do you expect \ to do?


How would you guys write a program that needs to run different functions with different intervals in C++? I was thinking about some sort of loop that checks if the time interval has passed, and store the function pointers with their desired intervals in a struct with some timestamp when they have been executed last

— Also some sort of signaling would do it, but what would be the best way to do this in C++, I think that my way is a bit C'ish

Message permanent page

— If I were to do so I would calculate time till next event and sleep till that, but what's the c++ way ... Idk

Message permanent page

— Nothing wrong with it being "C'ish"

— And if you want to time it precisely you'd be using std::chrono

— I was also thinking about something like a function that takes the function pointer and then launches a new thread which sleeps until the given time and always calls that function

Message permanent page

— But why do you need to run diffrent functions with n interval?

— How do you differentiate the code being c'ish or c++?

— I guess he wants to avoid function pointers

— But i don't see why and there's std::function

— It is a kind of a surveillance program lol, take screenshot at a user-defined interval, send logs to server every n minutes etc

Message permanent page