I need to copy a large file from pocket pc to my desktop and vice
versa. I tried using the CeRAPI library, but i get an overflow error. can
any one please tell me what am i doing wrong.

The file is 4.53 MB in size. and this is the code i am using
/////////////////////////////////////////////////
Dim bytBuffer(4605952) As Byte
dim lngFileHandle as long
dim lngBytesRead as long

lngFileHandle = CeCreateFile(Form1.txtPPCfile.Text, GENERIC_READ,
FILE_SHARE_READ, vbNullString, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)

intRetVal = CeReadFile(lngFileHandle, bytBuffer(0), 4605952,
lngBytesRead, 0)

/////////////////////////////////////////////////////////

when i run the above code, i get an overflow error. Is there a limit
on how big a file can be? Or am i missing anything

thanks
Nirankar

Re: Copying large files from pocket pc to desktop and vice versa by Ginny

Ginny
Wed Aug 20 19:22:07 CDT 2003

Nirankar,

Instead of trying to read the entire file at once, why not use a block size of
say, 1000 bytes, and read the file in blocks (and write it out in blocks) until
you have read it all. You can experiment with the block size to determine the
best performance.
--
Ginny Caughey
Windows Embedded MVP

"Nirankar Mehta" <nmehta@ochsner.org> wrote in message
news:%23OFIYK2ZDHA.2032@TK2MSFTNGP10.phx.gbl...
>
> I need to copy a large file from pocket pc to my desktop and vice
> versa. I tried using the CeRAPI library, but i get an overflow error. can
> any one please tell me what am i doing wrong.
>
> The file is 4.53 MB in size. and this is the code i am using
> /////////////////////////////////////////////////
> Dim bytBuffer(4605952) As Byte
> dim lngFileHandle as long
> dim lngBytesRead as long
>
> lngFileHandle = CeCreateFile(Form1.txtPPCfile.Text, GENERIC_READ,
> FILE_SHARE_READ, vbNullString, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
>
> intRetVal = CeReadFile(lngFileHandle, bytBuffer(0), 4605952,
> lngBytesRead, 0)
>
> /////////////////////////////////////////////////////////
>
> when i run the above code, i get an overflow error. Is there a limit
> on how big a file can be? Or am i missing anything
>
> thanks
> Nirankar
>
>
>



Re: Copying large files from pocket pc to desktop and vice versa by Chris

Chris
Thu Aug 21 07:58:15 CDT 2003

You're trying to read a 4MB file at once!? Try copying it in chunks.

--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net

"Nirankar Mehta" <nmehta@ochsner.org> wrote in message
news:%23OFIYK2ZDHA.2032@TK2MSFTNGP10.phx.gbl...
>
> I need to copy a large file from pocket pc to my desktop and vice
> versa. I tried using the CeRAPI library, but i get an overflow error. can
> any one please tell me what am i doing wrong.
>
> The file is 4.53 MB in size. and this is the code i am using
> /////////////////////////////////////////////////
> Dim bytBuffer(4605952) As Byte
> dim lngFileHandle as long
> dim lngBytesRead as long
>
> lngFileHandle = CeCreateFile(Form1.txtPPCfile.Text, GENERIC_READ,
> FILE_SHARE_READ, vbNullString, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
>
> intRetVal = CeReadFile(lngFileHandle, bytBuffer(0), 4605952,
> lngBytesRead, 0)
>
> /////////////////////////////////////////////////////////
>
> when i run the above code, i get an overflow error. Is there a limit
> on how big a file can be? Or am i missing anything
>
> thanks
> Nirankar
>
>
>



Re: Copying large files from pocket pc to desktop and vice versa by Chris

Chris
Thu Aug 21 13:07:19 CDT 2003

If you're doing VB.NET you can use OpenNETCF.Desktop.Communication

--
Chris Tacke, eMVP
Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net

"Nirankar Mehta" <nmehta@ochsner.org> wrote in message
news:eWMm3NAaDHA.2464@TK2MSFTNGP09.phx.gbl...
> can any one please give me an example ...how would i read a file in block,
> and write in block.
> Thanks
> Nirankar
> "Nirankar Mehta" <nmehta@ochsner.org> wrote in message
> news:#OFIYK2ZDHA.2032@TK2MSFTNGP10.phx.gbl...
> >
> > I need to copy a large file from pocket pc to my desktop and vice
> > versa. I tried using the CeRAPI library, but i get an overflow error.
can
> > any one please tell me what am i doing wrong.
> >
> > The file is 4.53 MB in size. and this is the code i am using
> > /////////////////////////////////////////////////
> > Dim bytBuffer(4605952) As Byte
> > dim lngFileHandle as long
> > dim lngBytesRead as long
> >
> > lngFileHandle = CeCreateFile(Form1.txtPPCfile.Text, GENERIC_READ,
> > FILE_SHARE_READ, vbNullString, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
> >
> > intRetVal = CeReadFile(lngFileHandle, bytBuffer(0), 4605952,
> > lngBytesRead, 0)
> >
> > /////////////////////////////////////////////////////////
> >
> > when i run the above code, i get an overflow error. Is there a
limit
> > on how big a file can be? Or am i missing anything
> >
> > thanks
> > Nirankar
> >
> >
> >
>
>



Re: Copying large files from pocket pc to desktop and vice versa by Ginny

Ginny
Thu Aug 21 13:42:49 CDT 2003

Niranka,

You have most the code already. ;-) Just use some block size instead of 4.5 Mb
and read in a loop, each time comparing the number of bytes returned with the
number you requested. If they aren't equal (yet ReadFile returns true), you're
at the end of the file so exit. While you're inside the loop, you just write the
number of bytes read to the output file.
--
Ginny Caughey
Windows Embedded MVP

"Nirankar Mehta" <nmehta@ochsner.org> wrote in message
news:eWMm3NAaDHA.2464@TK2MSFTNGP09.phx.gbl...
> can any one please give me an example ...how would i read a file in block,
> and write in block.
> Thanks
> Nirankar
> "Nirankar Mehta" <nmehta@ochsner.org> wrote in message
> news:#OFIYK2ZDHA.2032@TK2MSFTNGP10.phx.gbl...
> >
> > I need to copy a large file from pocket pc to my desktop and vice
> > versa. I tried using the CeRAPI library, but i get an overflow error. can
> > any one please tell me what am i doing wrong.
> >
> > The file is 4.53 MB in size. and this is the code i am using
> > /////////////////////////////////////////////////
> > Dim bytBuffer(4605952) As Byte
> > dim lngFileHandle as long
> > dim lngBytesRead as long
> >
> > lngFileHandle = CeCreateFile(Form1.txtPPCfile.Text, GENERIC_READ,
> > FILE_SHARE_READ, vbNullString, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)
> >
> > intRetVal = CeReadFile(lngFileHandle, bytBuffer(0), 4605952,
> > lngBytesRead, 0)
> >
> > /////////////////////////////////////////////////////////
> >
> > when i run the above code, i get an overflow error. Is there a limit
> > on how big a file can be? Or am i missing anything
> >
> > thanks
> > Nirankar
> >
> >
> >
>
>