Re: [Interest] Read a binary file

2012-12-21 Thread Yuriy Rusinov
Hello ! On Thu, Dec 20, 2012 at 12:40 AM, Mehmet İpek wrote: > In native c code you read unsigned long (4 byte in 32 bit platforms) and in > Qt code you read quint64 (64 bit in all platforms). Problem was here, thanks a lot. -- Best regards, Sincerely yours, Yuriy Rusinov.

Re: [Interest] Read a binary file

2012-12-19 Thread Mehmet İpek
I saw several issues in your Qt code. * In native c code you read unsigned long (4 byte in 32 bit platforms) and in Qt code you read quint64 (64 bit in all platforms). * You are reading with readLine which if it sees an end of line char, it stops reading. So, this is simply wrong. You have to use

Re: [Interest] Read a binary file

2012-12-19 Thread Yuriy Rusinov
Hello, Syam ! wrote: > On 12/19/2012 02:45 PM, Yuriy Rusinov wrote: >> for (int i=1; i<=na; i++) >> { >> char * colData = new char [nd2*sizeof (unsigned long)]; >> qint64 colLength = fData->readLine (colData, nd2*sizeof >> (unsigned long)); > > Why would you use readLi

Re: [Interest] Read a binary file

2012-12-19 Thread Syam Krishnan
On 12/19/2012 02:45 PM, Yuriy Rusinov wrote: > for (int i=1; i<=na; i++) > { > char * colData = new char [nd2*sizeof (unsigned long)]; > qint64 colLength = fData->readLine (colData, nd2*sizeof > (unsigned long)); Why would you use readLine() for a binary file? The conce

[Interest] Read a binary file

2012-12-19 Thread Yuriy Rusinov
I have to read binary file via Qt. In console application I make FILE * fid5 = fopen ("./test_data/source.rgg", "rb"); ... for (int i=1; i<=na; i++) { fread (st+i-1, sizeof (unsigned long), nd2, fid5); ... } and all work fine. In Qt application I try QStr