Hello Donald,

According to the FileRead documentation, if the number of blocks read
was less than requested, the EOF indicator is set, so you should be
able to tell if the read finished. After that, perhaps you could use
FileTell to get the size of the file, and thus how many bytes were
read?

I'm not sure if this is really worth the bother, but I suppose it
depends on the requirements of your application.

Adrien.

Wednesday, January 18, 2006, 5:36:24 PM, you wrote:

DCK> That was a problem I was thinking of. It seems pretty fast (although I am
DCK> trying it with a 5MB file on a TX, so it'll be a bit slow). The thing I was
DCK> concerned with was it would have 3Kb left to read, so I tell FileRead to
DCK> read 1 block of 4096, then FileRead returns 0. So then, how would I figure
DCK> out how much FileRead read (sounds way too redundant). I just decided that
DCK> performance probably would not bu hit if I told FileRead to read 4069 
blocks
DCK> of 1 byte.

DCK> My guess is that it is no different then doing:

DCK> totalSize = numBlocks * blockSize;

DCK> for (i=0; i < totalSize; i++) {
DCK>   outbufBuf[i] = inBuf[i];
DCK> }

DCK> or:

DCK> for (i=0; i < numBlocks; i++) {
DCK>     for (j=0; j < blockSize; j++) {
DCK>         outBuf[i+j] = inBuf[i+j]; // or something like this, you get the
DCK> idea...
DCK>     }
DCK> }

DCK> The only reason I think that there is a performance hit is that the TX has
DCK> to copy the 5MB file over to the DB Cache. I did notice that just before I
DCK> open it the device slows down really badly (after I call the FileClose to
DCK> close it after the HTTP engine has written to it). So my guess is that any
DCK> performance loss comes from moving the file from DB Cache to NVFS, from 
NVFS
DCK> to DB Cache and then from DB Cache to the card, and then back from DB Cache
DCK> to NVFS.

DCK> I tested the code with the 5MB Intel DUo Mac Processor add. Code worked
DCK> flawlessly.

DCK> Just to check, file streams are stored in DB Cache when being worked with,
DCK> correct?

DCK> Thanks again for all of the help,
DCK> Donald



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

Reply via email to