How to print Qdate value on screen
-
Hello, I am very new to Qt and I bumped into a problem that might well be stupid as far as I know. In the following chunk of code
QFile file("bds.txt"); QTextStream in(&file); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) return 1; QString discard,dateStr; QList<QDate> dates; while(!in.atEnd()) { in >> discard; in >> dateStr; dates.append(QDate::fromString(dateStr,"d'/'MMM'/'yyyy")); } QString dt ((dates[0]).toString()); std::cout << dt << std::endl;
I obtain the following error
error: no match for 'operator<<' (operand types are 'std::ostream {aka std::basic_ostream<char>}' and 'QString') std::cout << dt << std::endl;
So I created a TextStream as follows
QTextStream outt(stdout); .... .... outt << dt << std::endl;
Obtaining the following error
error: no match for 'operator<<' (operand types are 'QTextStream' and '<unresolved overloaded function type>') outt << dt << std::endl;
How can I overcome this problem and why am I having this problem in first place?
-