ReadFile() returns false

  • Thread starter Thread starter Luk Vloemans
  • Start date Start date
L

Luk Vloemans

Hey,

I'm a student working on a project to get data from a GPS onto a PDA.

This is the function I use to get data from the device:

if (ReadFile(m_ihandle, buf, 1, gotbytes, uOverlapped))
{
throw new CommPortException("Can not read from port " + cs.port);
}

The function seems to work, as the buffer always gets a new (sadly,
garbage) value. However, the gotbytes (int) remains 0, which means the
device didn't read any character at all.

Does anybody know why the ReadFile function doesn't work properly ?

Thank in advance,

Luk Vloemans
 
Luk Vloemans said:
I'm a student working on a project to get data from a GPS onto a PDA.

This is the function I use to get data from the device:

Which class are you using? Which language?
 
Luk Vloemans said:
I'm using the class COMReader in C#.

Hope this sounds familiar ?

Not at all, I'm afraid - but from the looks of how you were calling
ReadFile, I'm not surprised that the value of gotBytes doesn't change -
it's passed by value.

Do you have any documentation for it? A very quick Google search didn't
find it...
 
Back
Top