Determine the orientation of a stream.
Compatibility:This function is compatible with the following targets:
|
|
#include <stdio.h>  
int fwide(FILE *stream, int orientation);
Parameters for this facility are:
#include <stdio.h>
int main()
{
FILE * fp;
char filename[FILENAME_MAX];
int orientation;
char * cptr;
cptr = tmpnam(filename);
fp = fopen(filename, "w");
orientation = fwide(fp, 0);
// A newly opened file has no orientation
printf("Initial orientation = %i\n", orientation);
fprintf(fp, "abcdefghijklmnopqrstuvwxyz\n");
// A byte oriented output operation will set the orientation
// to byte oriented
orientation = fwide(fp, 0);
printf("Orientation after fprintf = %i\n", orientation);
fclose(fp);
fp = fopen(filename, "r");
orientation = fwide(fp, 0);
printf("Orientation after reopening = %i\n", orientation);
orientation = fwide(fp, -1);
// fwide with a non-zero orientation argument will set an
// unoriented file's orientation
printf("Orientation after fwide = %i\n", orientation);
orientation = fwide(fp, 1);
// but will not change the file's orientation if it
// already has an orientation
printf("Orientation after second fwide = %i\n", orientation);
fclose(fp);
remove(filename);
return 0;
}
Output:
Initial orientation = 0
Orientation after fprintf = -1
Orientation after reopening = 0
Orientation after fwide = -1
Orientation after second fwide = -1
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000