1. peek low & doswrap blockread
Is there anyone who is aware of a problem with doswrap.e or peek
I am using ver. 2.0 euphoria.
If I read a block of data into a sequence from a file using getc. I can
look at any location in the sequence and it is correct.
If I now take the same file and use the DosOpen, allocate_low a buffer,
and BlockRead some bytes into the buffer. If I peek(buffer_add). I find
that I am looking at the file name that I DosOpen with ?? and not the
buffer. Is some special procedure for peeking low ??
2. Re: peek low & doswrap blockread
>If I read a block of data into a sequence from a file using getc. I can
>look at any location in the sequence and it is correct.
>If I now take the same file and use the DosOpen, allocate_low a buffer,
>and BlockRead some bytes into the buffer. If I peek(buffer_add). I find
>that I am looking at the file name that I DosOpen with ?? and not the
>buffer. Is some special procedure for peeking low ??
Bernie,
Here is a snippet of code from a version of FILEMAN.E which used DOSWRAP.E
integer buffer,
iwork
object data
-- filehandle is an integer that got it's value from a call to DosOpen()
buffer = allocate_low(RECORDLENGTH) -- RECORDLENGTH is a global variable
-- telling me how many bytes to read
iwork = BlockRead(filehandle, buffer, RECORDLENGTH)
if iwork < RECORDLENGTH then
-- A full record was not read!
free_low(buffer)
return(-1) -- EOF occurred
end if
data = peek({buffer, RECORDLENGTH}) -- see library.doc for an explanation
-- of the syntax for peek()
free_low(buffer)
Now, note that as I found out, DOSWRAP will work only with DOS32 apps, and
not WIN32. The standard low memory functions are not available for EXW.EXE,
and to use the same interrupts as DOSWRAP in a Windows environment requires
jumping through so many hoops that it would make more sense to either use
the built in Euphoria routines, or use API calls.
Hope this was of some help,
Brian Jackson
bjackson at printinginc.com
3. Re: peek low & doswrap blockread
I am using dos32. I understand how to use peek. I'am only
looking at single byte at a time.