MFC 中用ifstream出現問題
error C2678: binary '>>' : no operator defined which takes a left-hand operand of type 'class istream' (or there is no acceptable conversion)
問題出現在這行
F1>>ctrlc[i].bianhao>>ctrlc[i].company>>ctrlc[i].leixing>>ctrlc[i].zaikeliang;
用ofstream的<<沒有問題,但ifstream的>>就出問題了呢?
#include "fstream.h"
#include "iostream.h"
ifstream F1("D:\\datebase\\messagebase.txt");
for(i=0; i<20; i++)
{
F1>>ctrlc[i].bianhao>>ctrlc[i].company>>ctrlc[i].leixing>>ctrlc[i].zaikeliang;
}//從檔案讀入陣列
F1.close();
uj5u.com熱心網友回復:
序列化:定義可序列化的類轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/92534.html
標籤:基礎類
