Re: peek low & doswrap blockread

new topic     » goto parent     » topic index » view thread      » older message » newer message

>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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu