Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : fgetws

wchar_t *fgetws(wchar_t * ws,int n,FILE * stream) ;

Return Type : wchar_t *

A pointer to a wide-character string, where each element is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets.
Read about return values of fgetws function .

1st Parameter Type : wchar_t *

A pointer to a wide-character string, where each element is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets.

1st Parameter

Pointer to the buffer where the wide string will be stored

2nd Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

2nd Parameter

The maximum number of wide characters to read, including the null terminator

3rd Parameter Type : FILE *

Pointer to FILE structure for file operations

3rd Parameter

Pointer to the file stream from which the wide string is to be read

Read more about parameters of fgetws in parameters section
The fgetwsfunction in C language Reads a line of wide characters from a stream.
The fgetws function reads wide characters from stream and stores them as a wide-character string into ws until (n-1) characters have been read or either a newline or the end-of-file is reached, whichever happens first. A null wide character is automatically appended after the characters read. This function is similar to fgets, but it reads wide characters instead of single-byte characters.
The fgetwsfunction takes 3 parameters:
  • wchar_t * `ws`: Pointer to the buffer where the wide string will be stored
  • int `n`: The maximum number of wide characters to read, including the null terminator
  • FILE * `stream`: Pointer to the file stream from which the wide string is to be read
Reads at most `n-1` wide characters from the specified file stream and stores them in the buffer pointed to by `ws`. The function stops reading on encountering a newline character or the end-of-file. The resulting wide string is null-terminated.
The fgetws function return value :
  • On success, the function returns ws
  • If the end-of-file is encountered while attempting to read a character, the eof indicator is set
  • If this happens before any characters could be read, the function returns NULL
  • If a read error occurs, the error indicator is set and NULL is returned

Output

This example demonstrates the basic usage of `fgetws`. It reads a file containing wide characters line by line and prints each line to the console.