[KDE-India] Reading Binary file

Aditya Mooley aditya.ml at gmail.com
Mon Jan 9 07:10:44 CET 2006


On 1/7/06, Till Adam <adam at kde.org> wrote:
>
> On Saturday 07 January 2006 13:43, you wrote:
> > On 1/7/06, Till Adam <adam at kde.org> wrote:
> > > On Saturday 07 January 2006 12:57, Aditya Mooley wrote:
> > > > QFile userfile(fileName);
> > > >     if ( !userfile.open(IO_ReadOnly) ) {
> > > >       QMessageBox::information(this, tr("HTTP"),
> > > >         tr("Unable to open the file %1: %2.")
> > > >         .arg(openFilesPath).arg(userfile.errorString()));
> > > >     }
> > > >     fileSize = userfile.size();
> > > >     userfile.readAll();
> > >
> > > Hm, you're not doing anything with teh read data here, so I can't
> really
> > > tell
> > > what the problem could be. Can you post the full source, maybe, or
> send
> > > it to
> > > me in private mail?
> >
> > Thanks for your prompt response. It's encouraging :)
> > I am attaching the source code for you to see.
>
> Hm, the file reading code looks correct. Does the right data get added to
> teh
> ByteArray? If you print out the bytearray, after the readAll, for example,
> does it have the stuff in there?


First of all thanks to Till for looking into the code. The code is working
fine for text files. It is reading the file correctly and showing correct
file size and also the file gets uploaded using QHttp. But for Binary files
it is reading only *4 bytes*.

Is there a "gotcha" for  reading binary files using QFile::readAll() ?

I have uploaded the source code here ->
http://sanisoft-demo.com/kdeDev/cpg.tar.gz
Please let me what's wrong in the code or am I missing something?
I am using FC3 with KDE 3.3.1-2.2

Thanks again in advance for all your help.

Regards,

--
Aditya
=============================================================
PHP Applications for E-Biz: http://www.sanisoft.com
Coppermine Picture Gallery: http://coppermine.sf.net
=============================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-india/attachments/20060109/2e65fc21/attachment.html


More information about the KDE-india mailing list