我正在嘗試調試我的程序,並且正在從名爲intInputFile的文件讀取值。我在看我的局部變量,看到它說intInputFile =不完整的類型。我試圖查找它,但沒有明確的答案,我不知道這意味着什麼。任何人都可以請解釋,因爲我認爲這搞亂了我的計劃。不完整類型,這是什麼意思?
謝謝。
intInputFile >> fileInt;
cout << "check" <<endl;
while(!intInputFile.eof())
{
intNode* anotherInt;
anotherInt = new intNode;
if(intList==NULL)
{
intList = anotherInt;
lastInt = anotherInt;
lastInt->nextNode = NULL;
lastInt->nextNode = new intNode;
}
else
{
lastInt = lastInt->nextNode;
lastInt->nextNode = NULL;
lastInt->nextNode = new intNode;
}
lastInt->intValue = fileInt;
intInputFile >> fileInt;
cout << "good" <<endl;
}
第一次執行後,它正確地讀取從文件中的第一個整數,但是在調試時,我注意到了不完整的類型。另外,我還包括cout < <「好」;看看它是否會運行到這一點,當我的程序執行時,它所做的只是重複顯示「好」。
下面是包括:
#include <iostream>
#include <string>
#include <fstream>
我把它定義爲一個普通ifstream的類型:
int fileInt; //int read from input file
ifstream intInputFile;
代碼片段將有助於調查確切的原因。 –
也許它只是一個*不完整的類型* ... –
@VallabhPatade我編輯了我原來的帖子。 –