Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fgetws(3) [osf1 man page]

fgetws(3)						     Library Functions Manual							 fgetws(3)

NAME
fgetws - Gets a string from a stream LIBRARY
Standard C Library (libc) SYNOPSIS
#include <stdio.h> #include <wchar.h> wchar_t *fgetws( wchar_t *wcs, int number, FILE *stream); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fgetws: XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to a buffer where output wide characters are stored. Points to the FILE structure of an open file. Specifies an upper bound (num- ber-1) on the number of characters to read. DESCRIPTION
The fgetws() function reads characters from stream, converts them into the corresponding wide characters, and stores the result in the wchar_t array pointed to by the wcs parameter. The function reads until number-1 characters have been read, it has read and stored in the buffer the (newline) character, or it has encountered the end-of-file condition. The function then appends a null wide character to the result stored in wcs. The fgetws() function parallels the fgets() function. RETURN VALUES
On successful completion, the fgetws() function returns a pointer to wcs. Under the following conditions, the function returns a null pointer: The function encounters the end of the file before any characters are read. In this case, fgetws() does not store any wide char- acters in wcs and sets the end-of-file indicator for the stream. A read error occurs. In this case, fgetws() sets both errno and the error indicator for stream. After a read error, the value of the file-position indicator for stream is indeterminate. [Tru64 UNIX] The func- tion could not convert the input character to a wide character. ERRORS
If any of the following conditions occur, the fgetws() sets errno to the corresponding value: The O_NONBLOCK flag is set for the file descriptor underlying stream and the process would be delayed in the fgetws() call. The file descriptor underlying stream is not a valid file descriptor that is open for reading. The data obtained from stdin or the stream did not contain valid characters in the current locale. The read operation was terminated by a signal, and no data was transferred. One of the following conditions was encountered: The process is in a background process group that is attempting to read from its controlling terminal and either the process is ignoring or blocking the SIGTTIN signal or the process group is orphaned. A physical I/O error occurred. This condition was defined starting with XSH Issue 4 Version 2. The file is a regular file and an attempt was made to read at or beyond the offset maximum that is associated with the corresponding stream. RELATED INFORMATION
Functions: clearerr(3), feof(3), ferror(3), fileno(3), fopen(3), fputws(3), fread(3), getc(3), gets(3), getwc(3), mbtowc(3), puts(3), scanf(3), wscanf(3) Standards: standards(5) delim off fgetws(3)

Check Out this Related Man Page

getws(3C)						   Standard C Library Functions 						 getws(3C)

NAME
getws, fgetws - get a wide-character string from a stream SYNOPSIS
#include <stdio.h> include <widec.h> wchar_t *getws(wchar_t *ws); #include <stdio.h> include <wchar.h> wchar_t *fgetws(wchar_t *restrict ws, int n, FILE *restrict stream); DESCRIPTION
The getws() function reads a string of characters from the standard input stream, stdin, converts these characters to the corresponding wide-character codes, and writes them to the array pointed to by ws, until a newline character is read, converted and transferred to ws or an end-of-file condition is encountered. The wide-character string, ws, is then terminated with a null wide-character code. The fgetws() function reads characters from the stream, converts them to the corresponding wide-character codes, and places them in the wchar_t array pointed to by ws until n-1 characters are read, or until a newline character is read, converted and transferred to ws, or an end-of-file condition is encountered. The wide-character string, ws, is then terminated with a null wide-character code. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. The fgetws() function may mark the st_atime field of the file associated with stream for update. The st_atime field will be marked for update by the first successful execution of fgetc(3C), fgets(3C), fgetwc(3C), fgetws(), fread(3C), fscanf(3C), getc(3C), getchar(3C), gets(3C), or scanf(3C) using stream that returns data not supplied by a prior call to ungetc(3C) or ungetwc(3C). RETURN VALUES
Upon successful completion, getws() and fgetws() return ws. If the stream is at end-of-file, the end-of-file indicator for the stream is set and fgetws() returns a null pointer. For standard-conforming (see standards(5)) applications, if the end-of-file indicator for the stream is set, fgetws() returns a null pointer whether or not the stream is at end-of-file. If a read error occurs, the error indicator for the stream is set and fgetws() returns a null pointer and sets errno to indicate the error. ERRORS
See fgetwc(3C) for the conditions that will cause fgetws() to fail. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |fgetws() is Standard. | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ SEE ALSO
ferror(3C), fgetwc(3C), fread(3C), getwc(3C), putws(3C), scanf(3C), ungetc(3C), ungetwc(3C)attributes(5), standards(5) SunOS 5.11 15 Oct 2003 getws(3C)
Man Page