did you check the return code from MemHandleNew()?
if you are reading very large blocks of data you should use
the feature manager.  Not sure if MemHandleNew() can allocate
more than 64K.

regards

danny



----- Original Message -----
From: "Laurie Davis" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Sunday, November 30, 2003 5:33 PM
Subject: Re: VFSFileRead and Simulator


> I have resolved the problem, but I do not understand why the solution
works.
> I created the following simple example.
>
> I basically open the file, write four bytes to the beginning of the file,
> and then read the next 65500 bytes. I need to add a VFSFileSeed before the
> read or the read fails.
>
> error = 0;
> UInt16 volRef;
> UInt32 volIterator = vfsIteratorStart;
> while (volIterator != vfsIteratorStop)
>    error = VFSVolumeEnumerate(&volRef, &volIterator);
>
> FileRef fileRef;
> error = VFSFileOpen(volRef, LinksFullPath, vfsModeReadWrite, &fileRef);
>
> error = VFSFileSeek(fileRef, vfsOriginBeginning, 0);
>
> UInt32 newData = 1234;
> error = VFSFileWrite(fileRef, sizeof(newData), &newData, NULL);
>
> error = VFSFileSeek(fileRef, vfsOriginBeginning, sizeof(newData));   //
why
> ???
>
> MemHandle blockHandle = MemHandleNew(65500);
> MemPtr blockPtr = MemHandleLock(blockHandle);
> UInt32 number;
> error = VFSFileRead(fileRef, 65500, blockPtr, &number);
> MemHandleUnlock(blockHandle);
> MemHandleFree(blockHandle);
>
>
>
>
>
> "palmDev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> > it works fine. it would help if you include some code
> > that you are using.
> >
> > regards
> >
> > danny
> > www.toysoft.ca
> >
> >
> >
> > ----- Original Message -----
> > From: "Laurie Davis" <[EMAIL PROTECTED]>
> > Newsgroups: palm-dev-forum
> > To: "Palm Developer Forum" <[EMAIL PROTECTED]>
> > Sent: Sunday, November 30, 2003 5:52 AM
> > Subject: VFSFileRead and Simulator
> >
> >
> > > I am having a problem with the VFSFileRead function on the Simulator.
> > > Whenever
> > > I try to read a file, the read stops after 4092 bytes. I get an error
> code
> > > of 7197.
> > > I tried reading in smaller chunks, but again it stops after 4092 bytes
> and
> > > returns the
> > > same error code for all subsequent reads. I do not know what this
error
> > > means, but
> > > since it appears to be just above emuErrorClass, I assume that it is a
> > > simulator
> > > specific error. There is also the possibility that the VFSFileWrite
did
> > not
> > > work
> > > properly, but there were no error codes, and the file appears to be
the
> > > right size.
> > >
> > > Laurie
> > >
> > >
> > >
> > > --
> > > For information on using the Palm Developer Forums, or to unsubscribe,
> > please see http://www.palmos.com/dev/support/forums/
> > >
> >
> >
> >
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to