This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Thousand separator in printf

Hi,
I want to do something like this

printf("The number = %d\r\n",1000000);

And I want it to show as The number = 1000,000
but I get The number = 1000000
also I have tried to use

setlocale(LC_ALL, "");
printf("The number = %'d\r\n",1000000);

But I get this warning that tells format string is not supported and I would not got my answer,

So how should I use printf to be able to print thousand separators?

Regards

Parents
  • Lol - don't you think the 10 minutes of exercise to write your own solution would be well spent time? That would mean you would own the license to the code. And you would understand it, which is an advantage if you later wants to change the behavior. And the only way to improve your skills is by training...

    The alternative is to spend the time to document your requirements and then make use of one of all rent-a-coder services available.

Reply
  • Lol - don't you think the 10 minutes of exercise to write your own solution would be well spent time? That would mean you would own the license to the code. And you would understand it, which is an advantage if you later wants to change the behavior. And the only way to improve your skills is by training...

    The alternative is to spend the time to document your requirements and then make use of one of all rent-a-coder services available.

Children
No data