Access violation when reading big text files
Hi, Can anyone help with my problem, please excuse my lack of programming expertise in advance
In my program I read in large files (sometimes a few hundred Mb) of comma separated values.
I read them in like so:
Code:
return;
while (!in.atEnd())
{
lineText = in.readLine();
}
Generally it reads files as expected apart from a few files where it crashes (error and stack frame below).
The strange thing is if I split the file in question into two halves then it works ok. I've checked There's nothing wrong with the files and It also works on much larger files without any problems.
I can see it's memory related and it's always happening at the same memory address.
Can anyone tell me whats going on?
Thanks in advance,
Jamie
Code:
Unhandled exception at 0x1026edee (msvcr90d.dll) in test.exe:
0xC0000005: Access violation writing location 0x302d1000.
msvcr90d.dll!memcpy(unsigned char * dst=0x302cc496, unsigned char * src=0x0249107a, unsigned long count=32768) Line 271
QtCored4.
dll!QString::append(const QString & str
={...
}) Line
1277 + 0x2d bytes
QtCored4.
dll!QString::operator+=(const QString & s
={...
}) Line
261 + 0x13 bytes
QtCored4.dll!QTextStreamPrivate::fillReadBuffer(__int64 maxBytes=-1) Line 575 + 0x5b bytes
QtCored4.
dll!QTextStreamPrivate
::scan(const QChar * * ptr
=0x001275f4,
int * length
=0x001275fc,
int maxlen
=0, QTextStreamPrivate
::TokenDelimiter delimiter
=EndOfLine
) Line
734 + 0x2a bytes
QtCored4.
dll!QTextStream::readLine(__int64 maxlen
=0) Line
1583 + 0x16 bytes
dev.exe!DTMfromXYZ::createDTM() Line 308 + 0x14 bytes