Re: Reading database file and writing to a buffer

Tech-Archive recommends: Speed Up your PC by fixing your registry



Evidently this horse doesn't feel like being lead to water, let alone
drinking. Let's try it this way.

fill out this code with your settigns and give us the values that the
comments ask about:

DWORD error = 0;
HANDLE hCompressFile = CreateFile(<use your parameters her>);
if((hCompressFile == NULL) || (hCompressFile == INVALID_HANDLE_VALUE))
{
error = GetLastError();
// what is the value of error?
return;
}

if(! ReadFile(hCompressFile, buf, size, &ret, NULL))

{
error = GetLastError();
// what is the value of error?
return;
}

Notice the fact that I'm looking to see if each API call fails. This is
called "error checking". You can also step through with the IDE and have it
execute each line individually. This is part of a process known as
"debugging". Finding out the value returned by GetLastError() when an API
call fails to do what you expect is called "information".

If you put these three things together, you'll find out why the code is
working, and it will take less time than it took me to write this post.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com

"kracks" <kirthikaiitm@xxxxxxxxx> wrote in message
news:4f7041f9-4164-4be8-8c84-96ab749acc33@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Apr 16, 10:04 am, "Chris Tacke, eMVP" <ctacke.at.opennetcf.dot.com>
wrote:
What errors? What is &ret? What is buf? What's the value of size? We
can't really help you if you don't give us more information than one line
of
code.

--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded communityhttp://community.OpenNETCF.com

"kracks" <kirthikai...@xxxxxxxxx> wrote in message

news:4bb54533-70bc-43f1-a2a8-1fa900b78d93@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx



I want to read database and write to a buffer
I tried
ReadFile(hCompressFile, buf, size, &ret, NULL)

hCompressFile - > HANDLE for databse(eg. test1.sdf)

But read file is throwing errors.
I was not able to read the database file and write to a buffer

Suggest me the ways to read and DB file and write to a buffer.- Hide
quoted text -

- Show quoted text -


hCompressFile - > HANDLE for databse(eg. test1.sdf)
void * buf;
ULONG size -> its the length of database file = 0xED000
ULONG ret -> NoofBytesRead


.



Relevant Pages

  • Re: Reading database file and writing to a buffer
    ... Chris Tacke, Embedded MVP ... ReadFile(hCompressFile, buf, size, &ret, NULL) ... Suggest me the ways to read and DB file and write to a buffer. ...
    (microsoft.public.windowsce.app.development)
  • Re: Reading database file and writing to a buffer
    ... Chris Tacke, Embedded MVP ... ReadFile(hCompressFile, buf, size, &ret, NULL) ... I was not able to read the database file and write to a buffer ... ULONG ret -> NoofBytesRead ...
    (microsoft.public.windowsce.app.development)
  • Re: accessing dll in eVC
    ... I see nothing declaring fpTsRequest, so my guess is you've not got it ... Chris Tacke, Embedded MVP ... BOOL LoadDLLFunction() ... BOOL ret = true; ...
    (microsoft.public.windowsce.embedded.vc)