>  Docs Center  >  Libraries  >  Daithi  >  SREAD

SREAD

SREAD

Name


    SREAD

Purpose


    This function extracts column delimited data (whitespace between columns)
    of data from a file and loads it into an string array.

Category


Input/output


Calling Sequence


    Result = sread( FILENAME )

Inputs


    FILENAME: The name of the file to open and read.
    COMMENT_CHAR, NOCOMPRES, SEPARATOR, SKIP_LINES, TRUNCATE, VERBOSE

Keyword Parameters


    COMMENT_CHAR: A string labeling the character used to denote comment
        within the file being read, and thus to be skipped. If not input then
        ';' is assumed. If set to '' then no comment lines are assumed.
    NOCOMPRESS: If set then whitespaces are not compressed to length 1. The
        default is compression.
    SEPARATOR: The string that separates columns of data.
    SKIP_LINES: An integer number of lines to skip from the beginning of the
        file.
    TRUNCATE: If this keyword is set any (non comment) lines longer than the
        first line will be truncated.
    VERBOSE: Write some information about the reading process to the terminal.

Outputs


    Result: A string array matching the content of the file is returned. A
        null string ('') is returned if there is an error.

Uses


    str.pro

Restrictions


    I am sure there are some but they are unknown.

Example


    text = sread( file, SKIP_LINES=5 )

Modification History


    Written by: Edward C. Wiebe, 2000-06-09.
    Modified: Edward C. Wiebe, 2002-02-07 (changed code to always return ''
        if there is an error)
    Modified: Edward C. Wiebe, 2002-03-05 (fixed a bug where the routine
        stopped with an error if the input filename was '' -- it now returns
        '')
    Modified: Daithi A. Stone (stoned@atm.ox.ac.uk), 2005-03-10 (switched use
        of obsolete findfile to file_search)
    Modified: DAS, 2007-01-17 (added NOCOMPRESS keyword)
    Modified: DAS, 2009-09-29 (changed use of stringc to str.pro)
    Modified: DAS, 2014-03-31 (Added COMMENT_CHAR keyword)
    Modified: DAS, 2014-08-15 (Fixed bug in treatment of blank lines)



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us