LabWindows/CVI

Ini_SetEncoding

int Ini_SetEncoding (IniText handle, IniFileEncodingType iniFileEncoding);

Purpose

Sets the encoding type for the in-memory object identified by handle. The function must be called before adding any tag/value pair. The function fails when you store content before calling the function.

Parameters

Input
Name Type Description
handle IniText A handle returned from Ini_New. It represents the list of in-memory tag/value pairs.

Returns an error when zero is passed.
iniFileEncoding IniFileEncodingType Encoding of content stored in the list of in-memory tag/value pairs.

The possible values are defined in enum IniFileEncodingType:
IniFileEncoding_AUTO Autodetect The default value when a new in-memory tag/value pair is created with Ini_New. Allows the read function to determine whether the stored content is ANSI or UTF-8 with byte order mark (BOM) encoded.
IniFileEncoding_ANSI ANSI Indicates that the stored content is ANSI encoded. Returns an error when a UTF-8 with BOM encoded file is read.
IniFileEncoding_UTF8BOM UTF-8 with BOM Indicates that the stored content is UTF-8 with BOM encoded. Returns an error when an ANSI encoded file is read.
IniFileEncoding_UTF8NOBOM UTF-8 without BOM Indicates that the stored content is UTF-8 without BOM encoded. Returns an error when an ANSI file is read.
IniFileEncoding_RAWBYTES Raw Bytes Indicates that the content is stored as raw bytes and encoding conversions are done on the strings. Both ANSI and UTF-8 functions will return the same string.

Return Value

Name Type Description
status int Indicates whether the function was successful.

A zero indicates success.

A negative value indicates an error. If the value is in the range of –1 to –999, the error code is defined in userint.h. If the value is in the range of –5000 to –5999, the error code is defined in toolbox.h.

For this function, the only errors you are likely to encounter are:
–184 Operation Failed! –65 Null Pointer passed!

Additional Information

Library: Reading/Writing .ini-Style Files

Include file: toolbox\inifile.h

LabWindows/CVI compatibility: LabWindows/CVI 2020 and later