SolFSStorage.WideCharToAnsi method


Pascal    Plain C    C++ (DLL/Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

SolFSStorage     See also    


Converts text in UTF-16 to system default encoding

Not applicable


not implemented;

[Plain C]
    long _stdcall StorageWideCharToAnsi( PWideChar Src, PChar *Buffer, LongWord *BufferSize, Bool AllocateBuffer );

[C++ (DLL/Lib)]
not implemented;

[C++ (VCL)]
not implemented;

[C++ (.NET)]
not implemented;

not implemented;

not implemented;

    not applicable;


  • Src - source text in system default encoding to be converted
  • Buffer - the buffer that holds the result of conversion (see method description)
  • BufferSize - size of the buffer (see method description)
  • AllocateBuffer - specifies whether the new buffer must be allocated or the passed one should be used

Return value

     [Plain C]  0 if the function succeeded or one of Error codes if the function failed.


This function is currently implemented only in CBFS Storage OS edition for Linux, FreeBSD and macOS.

Use this method to convert the string from UTF-16 encoding used by CBFS Storage to current encoding (the one used by the OS for the current process). Current encoding is determined using GetACP() function on Windows and setlocale() on Linux, FreeBSD and macOS.

You can specify the existing buffer to store the result by setting AllocateBuffer parameter to false. In this case you need to pass the existing buffer in Buffer parameter and set BufferSize to the size of the buffer. On return BufferSize will contain size of the converted data including terminating null character. If the passed buffer was large enough to hold the data, the data is copied to this buffer.

Alternatively you can tell CBFS Storage API to allocate new buffer. In this case Buffer parameter will be set to the newly allocated buffer and BufferSize will contain the size of the buffer (i.e. the size of the returned data including terminating null character). Allocated buffer must be freed using a call to FreeBuffer.

See also

FreeBuffer     AnsiToWideChar