API in C language.
More...
Detailed Description
API in C language.
Function Documentation
Destroys an instance of opencc.
- Parameters:
-
opencc | The description pointer. |
- Returns:
- 0 on success or non-zero number on failure.
Converts UTF-8 string This function returns an allocated C-Style string, which stores the converted string.
You MUST call opencc_convert_utf8_free() to release allocated memory.
- Parameters:
-
opencc | The opencc description pointer. |
input | The UTF-8 encoded string. |
length | The maximum length in byte to convert. If length is (size_t)-1, the whole string (terminated by '\0') will be converted. |
- Returns:
- The newly allocated UTF-8 string that stores text converted, or NULL on error.
Releases allocated buffer by opencc_convert_utf8.
- Parameters:
-
str | Pointer to the allocated string buffer by opencc_convert_utf8. |
Converts UTF-8 string.
- Parameters:
-
opencc | The opencc description pointer. |
input | The UTF-8 encoded string. |
length | The maximum length in byte to convert. If length is (size_t)-1, the whole string (terminated by '\0') will be converted. |
output | The buffer to store converted text. You MUST make sure this buffer has sufficient space. |
- Returns:
- The length of converted string or (size_t)-1 on error.
Returns the last error message.
Note that this function is the only one which is NOT thread-safe.
Makes an instance of opencc.
- Parameters:
-
configFileName | Location of configuration file. If this is set to NULL, OPENCC_DEFAULT_CONFIG_SIMP_TO_TRAD will be loaded. |
- Returns:
- A description pointer of the newly allocated instance of opencc. On error the return value will be (opencc_t) -1.