2 .TH "SD_ID128_TO_STRING" "3" "" "systemd 214" "sd_id128_to_string"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
17 .\" disable justification (adjust text to left margin only)
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
23 sd_id128_to_string, sd_id128_from_string \- Format or parse 128\-bit IDs as strings
28 #include <systemd/sd\-id128\&.h>
31 .HP \w'char\ *sd_id128_to_string('u
32 .BI "char *sd_id128_to_string(sd_id128_t\ " "id" ",\ char\ " "s" "[33]);"
33 .HP \w'int\ sd_id128_from_string('u
34 .BI "int sd_id128_from_string(const\ char\ *" "s" ",\ sd_id128_t\ *" "ret" ");"
37 \fBsd_id128_to_string()\fR
38 formats a 128\-bit ID as a character string\&. It expects the ID and a string array capable of storing 33 characters\&. The ID will be formatted as 32 lowercase hexadecimal digits and be terminated by a
42 \fBsd_id128_from_string()\fR
43 implements the reverse operation: it takes a 33 character string with 32 hexadecimal digits (either lowercase or uppercase, terminated by
44 \fBNUL\fR) and parses them back into a 128\-bit ID returned in
45 \fIret\fR\&. Alternatively, this call can also parse a 37\-character string with a 128\-bit ID formatted as RFC UUID\&.
47 For more information about the
50 \fBsd-id128\fR(3)\&. Note that these calls operate the same way on all architectures, i\&.e\&. the results do not depend on endianness\&.
52 When formatting a 128\-bit ID into a string, it is often easier to use a format string for
53 \fBprintf\fR(3)\&. This is easily done using the
54 \fBSD_ID128_FORMAT_STR\fR
56 \fBSD_ID128_FORMAT_VAL()\fR
57 macros\&. For more information see
61 \fBsd_id128_to_string()\fR
62 always succeeds and returns a pointer to the string array passed in\&.
63 \fBsd_id128_from_string\fR
64 returns 0 on success, in which case
66 is filled in, or a negative errno\-style error code\&.
70 \fBsd_id128_to_string()\fR
72 \fBsd_id128_from_string()\fR
73 interfaces are available as a shared library, which can be compiled and linked to with the
74 "libsystemd"\ \&\fBpkg-config\fR(1)