QTextStream을 사용하는 간단한 코드가 있으며 디버그 모드에서 매우 잘 작동하지만 출시 모드로 설정하면 QT4.6.3 vs2008을 사용하여 t read anything from the file. I included QtCore4.lib for the release mode and for the debug mode QtCored4.lib. I
m을 사용할 수 있습니다. 문제가 디버그 모드에서 작동하는 경우? 나는 아래 코드 삽입 :QTextStream 및 Visual Studio 2008 릴리스 모드
#include <iterator>
#include <QFile>
#include <QTextStream>
#include <QString>
#include<iostream>
#include<fstream>
#include<iterator>
#include<assert.h>
#include<stdio.h>
using namespace std;
void main()
{
QString qsArgsFile = "curexp.txt",line;
QByteArray baline;
cout<<qsArgsFile.toAscii().data();
QFile qfile(qsArgsFile);
assert(qfile.open(QIODevice::ReadOnly | QIODevice::Text));
QTextStream stream(&qfile);
baline = qfile.read(50);
const char *liner;
while(!(line = stream.readLine()).isNull())
if (!line.isEmpty()) {
baline = line.toLatin1();
liner = baline.data();
cout << liner << endl;
}
모두가 적어도 한 번이한다. 주장은 유용하지만 약간 악합니다. – Thomi
그렇습니다. 파일 시스템 상태, 입력 데이터, 사용자 동작 등과 같이 응용 프로그램 제어 이외의 조건에서는 절대로 assert()를 수행하지 마십시오. 물론이 문제는 assert()의 완전히 유효한 사용에도 발생할 수 있습니다. –
도움 주셔서 감사합니다! 이게 내 문제를 해결했고, 릴리스 모드에서는 assert가 건너 뛴다는 것을 알지 못했습니다. – Corgan