楼上的,我用你说的方法试了一下,但是有断错。以下是我要调用的程序
void DisplayDl::readFile()
{
uint BLOCKSIZE=1024;
uint filesize;
filename=qApp->argv()[1] //这里得到文件名称
QFile file(filename);
if (!file.open(IO_ReadOnly)
{
cout <<" The file can't open !" << endl;
}
QTextStream fromstream(&file);
QTextStream tostream;
filesize=(fromstream.read()).length();
char *p=new char[BOLCKSIZE];
while (filesize >0)
{
if (filesize >=BOLCKSIZe)
{
fromstream.readRawBytes(p,BLOCKSIZE);
tostream.writeRawBytes(p,BOLCISIZE); //执行这条语句的时候断错。程序跳出
textEdit->append(tostream.read());
filesize-=BLOCKSIZE;
}
else
{
fromstream.readRawBytes(p,filesize);
tostream.writeRawBytes(p,filesize);
textEdit->append(tostream.read());
filesize-=filesize;
}
}
}
可以帮我看看有什么问题吗