我有问题,尝试使用 QTextStream 读取或写入控制台的数据时出现访问冲突:
ApplicationStub.exe 中 0x77BD1D76 (ntdll.dll) 的第一次机会异常:0xC0000005:
访问冲突写入位置 0x00000014。ApplicationStub.exe 中 0x77BD1D76 (ntdll.dll) 处的未处理异常:0xC0000005:
访问冲突写入位置 0x00000014。
我的程序很简单:
#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();
}
可能是什么问题呢?谢谢
编辑 1 我也试过 QCoreApplication 我正在使用 Visual Studio 2013,Windows 7
同样在我的.pro文件中,我有:
QT += console
QT += core gui
我有gui选项,我认为这应该没问题。