fwide


fwide

Determines whether a stream is byte-character- or wide-character-oriented

 #include <stdio.h> #include <wchar.h> int fwide ( FILE *fp , int mode  ); 

The fwide( ) function either gets or sets the character type orientation of a file, depending on the value of the mode argument:


mode > 0

The fwide( ) function attempts to change the file to wide-character orientation.


mode < 0

The function attempts to change the file to byte-character orientation.


mode = 0

The function does not alter the orientation of the stream.

In all three cases, the return value of fwide( ) indicates the stream's orientation after the function call in the same way:


Greater than 0

After the fwide( ) function call, the file has wide-character orientation.


Less than 0

The file now has byte-character orientation.


Equal to 0

The file has no orientation.

The normal usage of fwide( ) is to call it once immediately after opening a file to set it to wide-character orientation. Once you have determined the file's orientation, fwide( ) does not change it on subsequent calls. If you do not call fwide( ) for a given file, its orientation is determined by whether the first read or write operation is byte-oriented or wide-oriented. You can remove a file's byte or wide-character orientation by calling freopen( ). For more information, see "Byte-Oriented and Wide-Oriented Streams" in Chapter 13.

Example

See the example for fputws( ) in this chapter.

See Also

The many functions for working with streams of wide characters, listed under wchar.h in Chapter 15.



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net