

It depends on whether you are printing to a terminal or to a file (and yes the terminal is also a file), and even then you can control the flushing behaviour using something like unbuffer
It depends on whether you are printing to a terminal or to a file (and yes the terminal is also a file), and even then you can control the flushing behaviour using something like unbuffer
printf
is superior and more concise, and snprintf
is practically the only C string manipulation function that is not painful to use.
Try to print a 32-bit unsigned int as hexadecimal number of exactly 8 digits, using cout
. You can do std::hex
and std::setw(8)
and std::setfill('0')
and don’t forget to use std::dec
afterwards, or you can just, you know, printf("%08x")
like a sane person.
Just don’t forget to use -Werror=format
but that is the default option on many compilers today.
C++23 now includes std::print
which is exactly like printf
but better, so the whole argument is over.
Synchronous translators are still very much in demand, as well as technical and legal translators.
Sometimes I’m searching for a recipe to some obscure Linux tool and finding my own answers on Stackoverflow from ten years ago.
As long as your byte consists of 8 bits.
Eh, who is still using paper books to learn programming languages? Every popular language has a website with online manuals.
Well, except C, because it’s crammed together with C++ on https://cplusplus.com/ and https://cppreference.com/
And socks just grow organically after 3 years of coding.
It’s a basic GIMP knowledge, really. Don’t forget to add an alpha channel to your layer after step 2, otherwise it won’t work.
Ah don’t worry, if you do
fopen(file, "w")
on Windows and forget to use"wb"
flag, it will automatically replace all your\n
with\r\n
when you dofwrite
, then you will try to debug for half a day your corrupted jpeg file, which totally never happened to me because I’m an experienced C++ developer who can never make such a novice mistake.