Results 1 to 3 of 3

Thread: copying into var buffer

  1. #1

    copying into var buffer

    Delphi 2005 Pro / Windows XP Home
    Pointer / var buffer / TStream

    for addressing memory inside a pointer i now use: TBuffer = array of byte;
    it works nicely but i need to use a for loop and a temp buffer.
    So i do a read from a TSream into a tempbuffer and copy it using the TBuffer trick into my var buffer.

    Now i would like to move larger blocks of memory at once. E.g. directly from stream.read into the var buffer without the temp buffer.
    Now how do i control the position inside the var buffer? Using the TBuffer to assign a start does not work.
    http://3das.noeska.com - create adventure games without programming

  2. #2

    copying into var buffer

    Is it something like this you are after?

    Code:
    var
      Buf : array of byte;
      Str : TStream;
    ...
    SetLength(Buf,2000);
    ...
    Str.Read(Buf[0],1000);   //Read a chunk of data to the beginning of buf
    ...
    Str.Read(Buf[500],1000);  //Read a chunk of data to position 500 in buf
    ZGameEditor - Develop 64kb games for Windows.
    Thrust for Vectrex - ROM-file and 6809 source code.

  3. #3

    copying into var buffer

    thanks, but i needed to do it diffently.

    solved it:
    Addr(TBuffer(@buffer)[pos])
    does the trick

    the @ before buffer is essential as it is a var buffer and not yet a pointer. And i forgot that the first time ops:
    http://3das.noeska.com - create adventure games without programming

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •