Generate a system-wide unique string.
const char *mtaUniqueString(char *buf, size_t *len, size_t max_len); |
Arguments |
Description |
---|---|
buf |
A pointer to a buffer to receive the NULL terminated unique string. The buffer should be at least 20 bytes long. |
len |
An optional pointer to a size_t to receive the length in bytes of the returned unique string. This length does not include the NULL terminator that terminates the returned unique string. A value of NULL can be passed for this call argument. |
len_max |
The maximum size in bytes of the buffer pointed at by buf. |
The mtaUniqueString() routine may be used to generate a system-wide unique string. The strings generated are suitable for use as MIME boundary markers and file names. On a successful completion, the unique string is stored in the buffer pointed at by the buf argument. Additionally, the value of the buf argument is returned as the routines return status.
In the event of an error, mtaUniqueString() will return NULL. The error status code may be obtained by examining the value of mta_errno.
Error Status Codes |
Description |
---|---|
MTA_BADARGS |
A value of NULL was supplied for the buf argument. |
MTA_STRTRUERR |
The buf buffer is too small. |
This routine is used in Example 5–2.