.STREAM READ

This subroutine is called to read a file stream.


Usage: (5.3.1 or earlier)

      PASS         <read_buffer>              FIELD            SHARE? Y
      PASS         <stream_name>              FIELD            SHARE? N
      PASS         <read_length>              FIELD            SHARE? Y
      GOSUB    --- .STREAM READ
      *        check for errors
      IF       --- .STREAM READ               NE

Usage: (5.3.2 or later)

      PASS         <read_buffer>              FIELD            SHARE? Y
      PASS         <stream_name>              FIELD            SHARE? N
      PASS         <read_length>              FIELD            SHARE? N
      PASS         <length_read>              FIELD            SHARE? Y
      GOSUB    --- .STREAM READ
      *        check for errors
      IF       --- .STREAM READ               NE

Description:

This subroutine is called to read a file stream previously opened for READ access via .STREAM OPEN.

The first two parameters are required, and the subroutine will CANCEL if they are are not all received. The <read_length> and <length_read> parameters are optional.

<read_buffer> contains the data read from <stream_name> (Required). This subroutine can read lines up to a maximum of 32000 characters long. This must be passed SHARED to return any data.

<stream_name> is the name of the previously opened stream (Required).

<read_length> is the number of bytes to read (optional). If not passed it will read up until a line termination character to a maximum of 32000 characters. If a value is passed it will read up to that number of characters or until a line termination character is encountered, whichever comes first. In Releases 5.3.1 and earlier, if passed shared, it will return the number of characters actually read, however, you should set it back to 32000 before the next GOSUB --- .STREAM READ, otherwise this subroutine will only read that number of characters. In Release 5.3.2 and higher, this will value not return anything and will not change, even if passed SHARED.

<length_read> is the number of characters actually read (5.3.2 and higher only). This must be passed SHARED to return a value.

If --- .STREAM READ contains 'Data was truncated', it means the <read_buffer> field you passed was not large enough to contain all the data that was read. If --- .STREAM READ contains 'EOF', then there is no more data to be read.

Comments:

Read what other users have said about this page or add your own comments.


-- JeanNeron - 2012-01-23

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r6 - 2014-03-19 - JeanNeron
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback