---
name: "WideCharToMultiByte"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/WideCharToMultiByte"
---

# WideCharToMultiByte(3w)

## NAME

**WideCharToMultiByte** (KERNEL32.@)

## SYNOPSIS

INT WideCharToMultiByte\
  (\
   UINT    *page*,\
   DWORD   *flags*,\
   LPCWSTR *src*,\
   INT     *srclen*,\
   LPSTR   *dst*,\
   INT     *dstlen*,\
   LPCSTR  *defchar*,\
   BOOL\*   *used*\
  )

## DESCRIPTION

Convert a Unicode character string into a multibyte string.

## PARAMS

*page* **\[In\]**  Code *page* character set to convert to.

*flags* **\[In\]**  Mapping Flags (**MB\_** constants from **"winnls.h"**).

*src* **\[In\]**  Source string buffer.

*srclen* **\[In\]**  Length of *src* (in WCHARs), or **-1** if *src* is **NUL** terminated.

*dst* **\[Out\]**  Destination buffer.

*dstlen* **\[In\]**  Length of *dst* (in bytes), or **0** to compute the required length.

*defchar* **\[In\]**  Default character to use for conversion if no exact conversion can be made.

*used* **\[Out\]**  Set if default character was *used* in the conversion.

## RETURNS

**Success:** If *dstlen* \> **0**, the number of characters written to *dst*. If *dstlen* == **0**, number of characters needed to perform the conversion. In both cases the count includes the terminating **NUL**.

**Failure:** **0.** Use **[GetLastError(3w)](/GetLastError/3w.md)** to determine the cause. Possible errors are **ERROR\_INSUFFICIENT\_BUFFER**, if not enough space is available in *dst* and *dstlen* != **0**, and **ERROR\_INVALID\_PARAMETER**, if an invalid parameter was given.

## IMPLEMENTATION

Declared in **"winnls.h"**.

Implemented in **"dlls/kernel32/locale.c"**.

Debug channel **"nls"**.
