# fgetws

From cppreference.com
< c‎ | io

Defined in header `<wchar.h>` |  |
wchar_t *fgetws( wchar_t *str, int count, FILE *stream ); |  | (since C95) (until C99)
wchar_t *fgetws( wchar_t * restrict str, int count, FILE * restrict stream ); |  | (since C99)

Reads at most count - 1 wide characters from the given file stream and stores them in `str`. The produced wide string is always null-terminated. Parsing stops if end-of-file occurs or a newline wide character is found, in which case `str` will contain that wide newline character.

### Parameters

str | - | wide string to read the characters to
count | - | the length of `str`
stream | - | file stream to read the data from

### Return value

`str` on success, NULL on an error

### References

- C11 standard (ISO/IEC 9899:2011):

  - 7.29.3.2 The fgetws function (p: 422)

- C99 standard (ISO/IEC 9899:1999):

  - 7.24.3.2 The fgetws function (p: 367-368)

### See also

wscanffwscanfswscanfwscanf_sfwscanf_sswscanf_s (C95)(C95)(C95)(C11)(C11)(C11) | reads formatted wide character input from stdin, a file stream or a buffer (function)
fgetwcgetwc (C95) | gets a wide character from a file stream (function)
fputws (C95) | writes a wide string to a file stream (function)
getlinegetwlinegetdelimgetwdelim (dynamic memory TR) | read from a stream into a automatically resized buffer until delimiter/end of line (function)

Retrieved from "https://en.cppreference.com/mwiki/index.php?title=c/io/fgetws&oldid=96427"