Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C Amendment |
both | z/OS® V1R7 |
#define _MSE_PROTOS
#include <stdio.h>
#include <wchar.h>
int fwide(FILE *stream, int mode);
#define _OPEN_SYS_UNLOCKED_EXT 1
#include <wchar.h>
int fwide_unlocked(FILE *stream, int mode);
fwide() determines the orientation of the stream pointed to by stream. If mode is greater than 0, the function attempts to make the stream wide-oriented. If mode is less than 0, the function attempts to make the stream byte-oriented. Otherwise, mode is 0 and the function does not alter the orientation of the stream, rather the function returns the current orientation of the stream.
If the orientation of the stream has already been determined, fwide() will not change it.
Streams opened as type=record or type=blocked do not have orientation.
VSAM data sets and CICS® transient data queues do not have orientation. Use of fwide() against streams referring to VSAM data sets or CICS transient data queues will be unsuccessful.
An application wishing to check for error situations should set errno to 0, then call fwide(), then check errno. If errno is non-zero assume an error has occurred.
fwide_unlocked() is functionally equivalent to fwide() with the exception that it is not thread-safe. This function can safely be used in a multithreaded application if and only if it is called while the invoking thread owns the (FILE*) object, as is the case after a successful call to either the flockfile() or ftrylockfile() function.
Special considerations for C++: The interaction of fwide() and a C++ I/O stream is undefined.
If successful, fwide() returns a value greater than 0 if the stream has wide-orientation after the call. It returns a value less than 0 if the stream has byte-orientation, or 0 if the stream has no orientation after the call.
When unsuccessful, fwide() returns 0 and sets errno to one of the following:
EBADF – The stream specified by stream was not valid.
EINVAL – The stream specified by stream was opened as type=record or type=blocked, or the stream refers to a VSAM data set or CICS transient data queue.