aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil++/freebsd__stringf.3
blob: 341fedef4343e6ec70f95f3f7e3101fc5351dc57 (plain) (blame)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 
.\" .\" SPDX-License-Identifier: BSD-2-Clause .\" .\" Copyright (c) 2025 Chelsio Communications, Inc. .\" Written by: John Baldwin <jhb@FreeBSD.org> .\" .Dd July 31, 2025 .Dt FREEBSD::STRINGF 3 .Os .Sh NAME .Nm freebsd::stringf .Nd build a std::string using stdio formatting .Sh LIBRARY .Lb libutil++ .Sh SYNOPSIS .In libutil++.hh .Ft std::string .Fn freebsd::stringf "const char *fmt" "..." .Ft std::string .Fn freebsd::stringf "const char *fmt" "va_list ap" .Sh DESCRIPTION These functions construct a .Vt std::string object containing a formatted string. The output of the string is dictated by the .Fa fmt argument and additional arguments using the same conventions documented in .Xr printf 3 . The first form provides functionality similar to .Xr asprintf 3 and the second form is similar to .Xr vasprintf 3 . .Sh RETURN VALUES These functions return a std::string object. .Sh EXCEPTIONS These functions may throw one of the following exceptions: .Bl -tag -width Er .It Bq Er std::bad_alloc Failed to allocate memory. .It Bq Er std::length_error The result would exceeed the maximum possible string size. .El .Sh EXAMPLES .Bd -literal -offset indent std::string s = freebsd::stringf("hello %s", "world"); .Ed .Sh SEE ALSO .Xr asprintf 3