Re: Palatable Windows IO using Ada



On 6 Apr 2006 17:21:44 -0700, Le wrote:

Wrappers we
have seen for the Win32 API simply export the ReadFile and ReadFileEx
which appear to be blocking by their very nature and demand that the
reader have apriori knowledge of the length of input expected at any
particular instance.

which is true for all kinds of any I/O in any OS. You should know the size
of the byte, block, record, line before you start to read it.

Windows ReadFile isn't always blocking, it can be asynchronous, see
"overlapping" I/O in MSDN description of ReadFile.

Of course one can deal with the varying length by doing all reads one
character at a time, but this is quite waseful in the face of Windows
already daunting CPU requirements.

Windows does buffering in background, so it isn't that wasteful. The
knowledge of how many items can be read at once depends solely on the
application.

As for serial I/O, there are further settings to keep in mind. See Windows
API SetCommTimeouts.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: newbie: I/O with nasm
    ... BOOL ReadFile( ... BOOL WriteFile( ... Now, if Windows is what TK is looking for, we've got something to go on. ... Pointer to the buffer that receives the data read from the file. ...
    (alt.lang.asm)
  • Re: Serial port read latency (SERIOUS - NEED HELP FAST!)
    ... In regular Windows XP, expecting a 5ms interval would normally encounter geers and cat-calls from the news group. ... Is the 5ms "window" the only termination, or are you using a protocol that defines end of text or message? ... ReadFile will complete when there is 5 ms interval between received bytes. ... > The protocol requires our embedded device to respond to a packet> within ...
    (microsoft.public.win32.programmer.kernel)
  • Asynch COM under Win98
    ... I tried this enquiry once on the messaging newsgroup but got no response. ... open the COM port and specify an lpOverlapped parameter on every ReadFile ... This is working fine on my Windows XP system. ... a bug report from a user saying that the application hangs on his "W98 SE" ...
    (microsoft.public.win32.programmer.kernel)
  • Overlapped COM access and Win98
    ... I have an application which drives a device via the serial port. ... open the COM port and specify an lpOverlapped parameter on every ReadFile ... This is working fine on my Windows XP system. ... a bug report from a user saying that the application hangs on his "W98 SE" ...
    (microsoft.public.win32.programmer.messaging)
  • Re: CreateFile and ReadFile caching
    ... Why at all you want to disable caching? ... I use CreateFile and ReadFile extensively. ... ReadFile on the same file again and again, the data isnt actually ... should on my windows filer. ...
    (microsoft.public.win32.programmer.kernel)