Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The LMX_HostidSimple function retrieves the HostID from the computer system and returns it as a NULL-terminated string.

Prototype

Code Block
languagecpp
LMX_STATUS LMX_HostidSimple
(
   LMX_HANDLE LmxHandle,
   LMX_HOSTID_TYPE eHostidType,
   char *szHostid
);

Parameters

LmxHandle
[in/out] LM-X handle.

...

On failure, this function returns an error code in the format described in Return codes.

Remarks

If there are no HostIDs of the requested type, the string will be empty. If there is more than one of the requested type, the HostIDs are separated by commas.

...

To make use of custom HostIDs, you must set a callback function using LMX_SetOption with the flag LMX_OPT_CUSTOM_HOSTID_FUNCTION.

Example

You can use the following code to retrieve all the HostIDs with the LMX_HOSTID_IPADDRESS type that are currently in use and display them on success.

Code Block
languagecpp
#include <lmx.h>
#include <stdio.h>

LMX_HANDLE h;

int main() 
{
  char s[LMX_MAX_LONG_STRING_LENGTH];

  exit_on_error(LMX_Init(&h));
  exit_on_error(LMX_HostidSimple(h, LMX_HOSTID_IPADDRESS, s));
  printf("HostIDs found: %s\n", s);
  
  return 0;
}

...