ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.pod
(Generate patch)

Comparing libecb/ecb.pod (file contents):
Revision 1.90 by root, Tue Jun 22 00:01:15 2021 UTC vs.
Revision 1.91 by root, Tue Jun 22 01:07:29 2021 UTC

934=head3 HIGH LEVEL API 934=head3 HIGH LEVEL API
935 935
936The high level API consists of four functions, one each for C<int32_t>, 936The high level API consists of four functions, one each for C<int32_t>,
937C<uint32_t>, C<int64_t> and C<uint64_t>: 937C<uint32_t>, C<int64_t> and C<uint64_t>:
938 938
939Example:
940
941 char buf[ECB_I2A_MAX_DIGITS + 1];
942 char *end = ecb_i2a_i32 (buf, 17262);
943 *end = 0;
944 // buf now contains "17262"
945
939=over 946=over
940 947
941=item ECB_I2A_I32_DIGITS (=11) 948=item ECB_I2A_I32_DIGITS (=11)
942 949
943=item char *ecb_i2a_u32 (char *ptr, uint32_t value) 950=item char *ecb_i2a_u32 (char *ptr, uint32_t value)
983for "leading zeroes"), functions that generate up to N digits, skipping 990for "leading zeroes"), functions that generate up to N digits, skipping
984leading zeroes (C<_N>), and functions that can generate more digits, but 991leading zeroes (C<_N>), and functions that can generate more digits, but
985the leading digit has limited range (C<_xN>). 992the leading digit has limited range (C<_xN>).
986 993
987None of the functions deal with negative numbera. 994None of the functions deal with negative numbera.
995
996Example: convert an IP address in an u32 into dotted-quad:
997
998 uint32_t ip = 0x0a000164; // 10.0.1.100
999 char ips[3 * 4 + 3 + 1];
1000 char *ptr = ips;
1001 ptr = ecb_i2a_3 (ptr, ip >> 24 ); *ptr++ = '.';
1002 ptr = ecb_i2a_3 (ptr, (ip >> 16) & 0xff); *ptr++ = '.';
1003 ptr = ecb_i2a_3 (ptr, (ip >> 8) & 0xff); *ptr++ = '.';
1004 ptr = ecb_i2a_3 (ptr, ip & 0xff); *ptr++ = 0;
1005 printf ("ip: %s\n", ips); // prints "ip: 10.0.1.100"
988 1006
989=over 1007=over
990 1008
991=item char *ecb_i2a_02 (char *ptr, uint32_t value) // 32 bit 1009=item char *ecb_i2a_02 (char *ptr, uint32_t value) // 32 bit
992 1010

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines