Commit cdd9d92d authored by Jose Luis Duran's avatar Jose Luis Duran Committed by Konstantin Belousov
Browse files

strfmon(3): Add an EXAMPLES section

Reviewed by:	kib
MFC after:	1 week
parent bc4346e0
......@@ -149,6 +149,31 @@ The
.Fn strfmon_l
function returns the same values as
.Fn strfmon .
The following example will format the value
.Dq Li 1234567.89
to the string
.Dq Li $1,234,567.89 :
.Bd -literal -offset indent
#include <stdio.h>
#include <monetary.h>
#include <xlocale.h>
char string[100];
double money = 1234567.89;
if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL) {
fprintf(stderr, "Unable to setlocale().\\n");
return (1);
strfmon(string, sizeof(string) - 1, "%n", money);
printf("%s\\n", string);
.Fn strfmon
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment