As you're using C++, you might consider using a std::map for the internal data structure. e.g std::map<int, account>. If you do that, then you can access an account via its account number, without searching for it
std::map<int, account> accounts;
accounts[account_no].dep(amount); // add amount to an account;
within worker thread, could a pointer to CDialog access its member variables or even functions, nothing to do with its UI elements, without using postmessage or sendmessage?. I expect the answer is YES.
I'm not sure what the difference is in your mind. std::cout and std::format (C++ 20) aren't really API's in my mind. They're fine for a simple utility (think ping or netstat), writing log files or doing data I/O, but quickly become unweildly when trying to do full screen I/O like menus, dialogs, pop-ups etc. If you're pursuing the latter, then you probably want to use a library that handles all the screen painting for you, managing overlays, pull down menus, etc. You might want to look at this page to see if any of them meet your needs C++ Library TUI libraries | LibHunt
You can probably find other examples googling for C++ TUI libraries.
The libraries that get fancy tended to rely on stuff that I couldn't be sure existed or at least would existed in the future.
Not to mention that a console app should be pretty simple in the first place. If you need complex user interactions then a console app probably isn't the way.
If I didn't want a normal UI then I would be more likely to control it via either command line options and/or configuration files. Actually I have been doing just those for years without any need for anything else.
Maybe there's a simpler way to do this. Or a good tutorial ?
I have a time string formatted like this (with spaces): "07 h 08 min 51 s"
According to the documentation, should the format string should be "%H h %M min %S s" ?
And if I understand how this should work, I should be able to do something like that, no?
Is there something I am missing ? or just the documentation too obtuse ?
const std::string time("07 h 08 min 51 s");
const std::string format("%H h %M min %S s");
iss >> std::chrono::parse(format, tp);
Your time string doesn't fully specify a time point. You can change it to:
iss >> std::chrono::parse (format, d);
and d is correctly calculated as 25731, which represents your time converted to seconds.
In the docs the key point is:
If from_stream fails to parse everything specified by the format string, or if insufficient information is parsed to specify a complete result, or if parsing discloses contradictory information, is.setstate(std::ios_base::failbit) is called.
If it supports text, then use a font icon; e.g. Emoji, etc.
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I