#include <stdio.h>
|
#include <wchar.h>
|
int
fwide (FILE *stream, int mode); |
If the orientation of stream has already been determined, fwide leaves it unchanged. Otherwise, fwide sets the orientation of stream according to mode.
If mode is less than zero, stream is set to byte-oriented. If it is greater than zero, stream is set to wide-oriented. Otherwise, mode is zero, and stream is unchanged.
#include <stdio.h> #include <wchar.h> /* Illustrates how to use fwide API */ int example_fwide(void) { FILE *fp = NULL; int retval; int mode; /* open a file */ fp = fopen("input.txt","r"); if(fp == NULL) { wprintf(L"Error: File open\n"); return (-1); } /* set the mode to wide*/ mode = 1; /* set the orientation of the file */ retval = fwide(fp, mode); /* check the return value */ if(retval == 1) { wprintf(L"Mode set to WIDE\n"); } else { wprintf(L"Error setting the mode to wide!!\n"); } /* set the mode to determine the orientation */ mode = 0; /* Read back the orientation that was set */ retval = fwide(fp ,mode); if(retval == 1) { wprintf("Mode not changed\n"); } else { wprintf("Error, mode changed!!\n"); } /* Close the file open for writing */ fclose(fp); /* return the mode of fp */ return (retval); }
© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |