1SD_ID128_TO_STRING(3) sd_id128_to_string SD_ID128_TO_STRING(3)
2
3
4
6 sd_id128_to_string, sd_id128_from_string - Format or parse 128-bit IDs
7 as strings
8
10 #include <systemd/sd-id128.h>
11
12 char *sd_id128_to_string(sd_id128_t id, char s[33]);
13
14 int sd_id128_from_string(const char *s, sd_id128_t *ret);
15
17 sd_id128_to_string() formats a 128-bit ID as a character string. It
18 expects the ID and a string array capable of storing 33 characters. The
19 ID will be formatted as 32 lowercase hexadecimal digits and be
20 terminated by a NUL byte.
21
22 sd_id128_from_string() implements the reverse operation: it takes a 33
23 character string with 32 hexadecimal digits (either lowercase or
24 uppercase, terminated by NUL) and parses them back into a 128-bit ID
25 returned in ret. Alternatively, this call can also parse a 37-character
26 string with a 128-bit ID formatted as RFC UUID.
27
28 For more information about the "sd_id128_t" type see sd-id128(3). Note
29 that these calls operate the same way on all architectures, i.e. the
30 results do not depend on endianness.
31
32 When formatting a 128-bit ID into a string, it is often easier to use a
33 format string for printf(3). This is easily done using the
34 SD_ID128_FORMAT_STR and SD_ID128_FORMAT_VAL() macros. For more
35 information see sd-id128(3).
36
38 sd_id128_to_string() always succeeds and returns a pointer to the
39 string array passed in. sd_id128_from_string returns 0 on success, in
40 which case ret is filled in, or a negative errno-style error code.
41
43 The sd_id128_to_string() and sd_id128_from_string() interfaces are
44 available as a shared library, which can be compiled and linked to with
45 the "libsystemd" pkg-config(1) file.
46
48 systemd(1), sd-id128(3), printf(3)
49
50
51
52systemd 219 SD_ID128_TO_STRING(3)