Version String Manipulation (verstring.cc)

These are version number and string manipulations, mostly specific to Net Integration software.

Version numbers are 32-bit hexadecimal numbers such as 0x00012a00. The first 16 bits are the major version, and the second 16 bits are the (fractional) minor version. For example, the above example corresponds to version "1.2a" (which is the version string).

You can numerically compare version numbers using the standard C < and > operators, which is what makes them useful.

Verstring cannot deal with version numbers that contain more than four digits to the left or right of the decimal, letters greater than f, or more than one decimal.

ver_to_string()

const char *ver_to_string(unsigned int ver)

Converts an integer, like 0x00012a00, to a string, like 1.2a.

string_to_ver()

unsigned int string_to_ver(const char *str)

Converts a string, like 1.2a, to an integer, like 0x00012a00.