I’ve unfortunately been writing some C++. It’s the crappiest language in the world. I just wasted 90 perfectly good minutes attempting to put thousands separators in numbers that I’m printf
ing. If you naively read the man pages, it looks easy — just include '
in your format specifier. Unfortunately, the hidden requirement is that you call this earlier in your code:
1 2 3 4 5 6 7 |
|
Edit: I was developing under OS X with XCode 3.2.6.
1 2 3 4 |
|
I also verified this works under linux, or at least centos. The man page for printf
doesn’t even mention apostrophe as an option, but it still works as long as you call setlocale
.
1 2 3 4 |
|