Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HardenedBSD
HardenedBSD
Commits
cdd9d92d
Commit
cdd9d92d
authored
Nov 08, 2022
by
Jose Luis Duran
Committed by
Konstantin Belousov
Jan 25, 2023
Browse files
strfmon(3): Add an EXAMPLES section
Reviewed by: kib MFC after: 1 week
parent
bc4346e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/libc/stdlib/strfmon.3
View file @
cdd9d92d
...
...
@@ -149,6 +149,31 @@ The
.Fn strfmon_l
function returns the same values as
.Fn strfmon .
.Sh EXAMPLES
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>
int
main()
{
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);
}
.Ed
.Sh ERRORS
The
.Fn strfmon
...
...
Shawn Webb
@shawn.webb
mentioned in commit
91498303
·
Jan 31, 2023
mentioned in commit
91498303
mentioned in commit 9149830359bfc816e916d24fab4acd5c0e70e13d
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment