# int2hex()

## Purpose

int2hex(num)

Returns a hexadecimal number string of a given positive integer num.

Note

When a negative integer is given the return value will be the Two’s complement of the input number.

## Example

### Positive Integer given

In the following example the hexadecimal number of 61 is returned as a string.

    int2hex(61)

produces

    3d

### Negative Integer given

This example shows the result on a 64-bit system when a negative integer such as -13 is put into the function.

    int2hex(-13)

produces

    fffffffffffffff3

Support: rsyslog Assistant | GitHub Discussions | GitHub Issues: rsyslog source project

Contributing: Source & docs: rsyslog source project

© 2008–2025 Rainer Gerhards and others. Licensed under the Apache License 2.0.