Solved how to pass QFile pointer to the QTextStream object
-
Hi Guys,
I have declared the QFile pointer and I want to pass it to QTextStream object but it says that the invalid use of incomplete type class QTextStream.QFile *fp=new QFile("file address"); QTextStream txtline(fp);
I did
QTextStream txtline(&fp);
but it did not work for me,
could you help me? -
@thippu said in how to pass QFile pointer to the QTextStream object:
invalid use of incomplete type class QTextStream.
have you included QTextStream ?
#include <QTextStream>
-
@J.Hilk Thank you bro.
It was the mistake. Ur right, It is working fine. -
@J.Hilk Even though I did not do the #include<QTextStream>
the compiler did not say anything about it? -
@thippu without going through the source code, my guess would be, its somewhere forwart declaired in one of Qt's base classes. So the compiler knows of the class but knows not what to do withit until you add the proper include.
-
Okay, Thanks
-
@thippu said in how to pass QFile pointer to the QTextStream object:
the compiler did not say anything about it?
It did: "but it says that the invalid use of incomplete type class QTextStream"
"incomplete type" means that compiler does not know what QTextStream is, which usually means that the include is missing. -
@jsulm, Thank you.