FGETWS(3POSIX)
π FGETWS(3POSIX) π
ok so bestie, welcome to the POSIX Programmer's Manual β¨ this lil page lives in FGETWS(3POSIX), and it's all about grabbing a wide-character string off a stream. yes, wide. we're being fancy today π
πΈ PROLOG πΈ
okay so real talk first: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. π
like, no cap, check your own platform before you go feral.
β¨ NAME β¨
fgetws β get a wide-character string from a stream π«Ά
π SYNOPSIS π
#include <stdio.h>
#include <wchar.h>
wchar_t *fgetws(wchar_t *restrict ws, int n,
FILE *restrict stream);
it's giving "small function, big responsibilities" fr fr π
π¦ DESCRIPTION π¦
The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of POSIX.1β2017 defers to the ISO C standard. so like, if they ever beef, ISO C wins, periodt. π
so what does fgetws() actually do, you ask? it shall read characters from the stream, convert these to the corresponding wide-character codes, and place them in the wchar_t array pointed to by ws. and it keeps going until:
n-1characters are read, OR- a
<newline>is read, converted, and transferred to ws, OR - an end-of-file condition is encountered. π₯Ί
then, once all that's done, the wide-character string, ws, shall be terminated with a null wide-character code. slay, clean ending, we love a properly terminated string β¨
β οΈ bestie listen: if an error occurs, the resulting value of the file position indicator for the stream is unspecified. that's the scary kind of unspecified. don't build your whole personality around it. π
also, the fgetws() function may mark the last data access timestamp of the file associated with stream for update. and like, it shall be marked for update by the first successful execution of fgetwc(), fgetws(), fwscanf(), getwc(), getwchar(), vfwscanf(), vwscanf(), or wscanf() using stream that returns data not supplied by a prior call to ungetwc(). iykyk β that's a whole friend group of functions right there π«
π RETURN VALUE π
Upon successful completion, fgetws() shall return ws. iconic behavior, honestly. π
if the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-of-file indicator for the stream shall be set and fgetws() shall return a null pointer. π
if a read error occurs, the error indicator for the stream shall be set, fgetws() shall return a null pointer, and shall set errno to indicate the error. so like, check errno, bestie, it's literally right there. π«Ά
π₯ ERRORS π₯
Refer to fgetwc(). that's it, that's the whole section, go read the other one π
The following sections are informative.
π EXAMPLES π
None. π we're keeping it mysterious.
β APPLICATION USAGE β
None. β¨
π§ RATIONALE π§
None. π
πΈ FUTURE DIRECTIONS πΈ
None. π
π SEE ALSO π
- Section 2.5, Standard I/O Streams
fopen()fread()- The Base Definitions volume of
POSIX.1β2017,<stdio.h>,<wchar.h>π¦
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole vibe check bestie π«Ά this little masterpiece came to you from IEEE/The Open Group, dated 2017, filed under FGETWS(3POSIX). go forth and read your wide characters, you absolute main character π
β¨π
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms