Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdb_u8TOu16

Converts an ASCII or UTF-8 encoded string to a UTF-16 string.

DECLARATION

NINT ctdb_u8TOu16(pTEXT u8str, pWCHAR u16str, NINT u16size);

DESCRIPTION

ctdb_u8TOu16() converts an ASCII or UTF-8 encoded string to a UTF-16 Unicode string. The input strings are assumed to be terminated by a NULL character. All output buffer sizes are specified in bytes.

RETURN

Value

Symbolic Constant

Explanation

0

NO_ERROR

No error occurred.

153

VBSZ_ERR

Output buffer too small.

446

BMOD_ERR

Bad key segment mode.

See Appendix A for a complete listing of valid c-tree Plus error values.

EXAMPLE

WCHAR buffer[256];

switch (ctdb_u8TOu16("tablename", buffer, sizeof(buffer))

{

case CTDBRET_OK:

{

printf("UTF-8 to UTF-16 conversion ok\n");

break;

}

case VBSZ_ERR:

{

printf("Conversion buffer is too small\n");

break;

}

case BMOD_ERR:

{

printf("Problem occurred during conversion\n");

break;

}

default:

{

printf("Unknown error code\n");

break;

}

}

SEE ALSO

ctdb_u16TOu8()

TOCIndex