Re: newbie: I/O with nasm



On Tue, 07 Mar 2006 19:14:26 -0500, Frank Kotler
<fbkotler@xxxxxxxxxxx> wrote:
<snip>
For more practical purposes, if we're allowed to call availabe OS
services, dos and Linux are easy. For Windows, I think we're going to
have to call GetStdHandle with -10 for stdin, and -11 for stdout (that
seems too insane to be true!). Then, ReadFile and WriteFile might take a
parameter to say whether it's unicode or not, and I think ReadFile wants
a parameter telling it where to put "status" - number of characters read
or errno - rather than returning it in eax... Otherwise not too much
different than the read()/write() example.

Windows Readfile & WriteFile (from MSDN):

BOOL ReadFile(
HANDLE hFile, // handle to file
LPVOID lpBuffer, // data buffer
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // number of bytes read
LPOVERLAPPED lpOverlapped // overlapped buffer
);

BOOL WriteFile(
HANDLE hFile, // handle to file
LPCVOID lpBuffer, // data buffer
DWORD nNumberOfBytesToWrite, // number of bytes to write
LPDWORD lpNumberOfBytesWritten, // number of bytes written
LPOVERLAPPED lpOverlapped // overlapped buffer
);
<snip>
--
ArarghMail603 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.
.



Relevant Pages

  • Re: can not delete excutable in Pocket PC [or WinCE]
    ... For serial I/O, as we've discussed in this group previously, you can close ... WriteFile() operation under way on the port to complete with an error. ... when it gets an error back from ReadFile or WriteFile, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Retrofitting base class with pure virtual function
    ... I believe that every derived class already has a real ReadFile ... the base class had the pure virtual ReadFile and WriteFile methods. ...
    (microsoft.public.vc.mfc)
  • Re: Unicode issue
    ... WriteFile() and ReadFile. ... ReadFile are fail and the name of the file that i have created is pane. ... You can create and use ASCII files. ... If you really want to create UNICODE files that other programs can ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: WriteFile()
    ... Again, when a timeout concept is NOT part of the design, a BLOCK call can ... Therefore, when there is NO timeout conditions, a blocking WriteFile() call ... documentation on the expected behavior of Read/WriteFile. ... let's apply your argument to ReadFile. ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Datei einlesen: Lesefehler simulieren
    ... Die Datei wird nur zur Hälfte geschrieben ... Diese nutzen ja ihrerseits ReadFile und WriteFile und werfen bei ... einem Fehler eine Exception. ... ReadFile hat "erfolgreich" gemeldet und 0 Bytes gelesen geliefert, ...
    (microsoft.public.de.vc)