I have problem, got access violation when trying to use QTextStream for data reading or writing to console:
First-chance exception at 0x77BD1D76 (ntdll.dll) in ApplicationStub.exe: 0xC0000005:
Access violation writing location 0x00000014.Unhandled exception at 0x77BD1D76 (ntdll.dll) in ApplicationStub.exe: 0xC0000005:
Access violation writing location 0x00000014.
My program is simple:
#include <QtWidgets/QApplication>
#include <iostream>
#include <QTextStream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
///////////////////////////////////////////////CONSOLE
QTextStream out(stdout);
out << "Please enter login username and password\n";
out.flush();
QTextStream in(stdin);
QString line;
in >> line;
return app.exec();
}
What could be the problem? Thanks
Edit 1 I also tried QCoreApplication I am using Visual studio 2013, Windows 7
Also in my .pro file I have:
QT += console
QT += core gui
I have there gui for gui option, i think this should be ok.

QApplicationtoQCoreApplication. Did you define the project like a Console app? You should add the .pro file. - JMA