📅  最后修改于: 2020-09-25 09:30:45             🧑  作者: Mango
fwide() 函数在
int fwide( FILE* stream, int mode );
根据mode的值,确定fwide 函数的作用。
fwide() 函数返回:
#include
#include
#include
using namespace std;
int main()
{
FILE *fp;
int retVal;
fp = fopen("file.txt","r");
retVal = fwide(fp,0);
if (retVal == 0)
cout << "Stream has no orientation" << endl;
else if (retVal > 0)
cout << "Stream is wide-oriented" << endl;
else
cout << "Stream is byte-oriented" << endl;
/* wide oriented stream */
cout << "Setting stream to wide-orientation" << endl;
retVal = fwide(fp,1);
if (retVal == 0)
cout << "Stream has no orientation" << endl;
else if (retVal > 0)
cout << "Stream is wide-oriented" << endl;
else
cout << "Stream is byte-oriented" << endl;
return 0;
}
运行该程序时,输出为:
Stream has no orientation
Setting stream to wide-orientation
Stream is wide-oriented