Read contents of text file into string list.
Syntax: @wread(filespec[, mode])
filespec: <file name of a text file on disk>
mode: string
Return: string
Returns a (potentially preprocessed) string containing the contents of the specified text file on disk.
The mode parameter specifies how the contents are parsed into individual fields and processed before being concatenated and returned by the function. The mode parameter may be used to specify a delimiter, or to instruct EViews to bypass preprocessing.
The following mode options specify the delimiter used to separate the input text into fields prior to concatenation:
• “t” or “tabs” (tabs)
• “,” or “c”, or “comma” (commas)
• “cr” or “nl” (line breaks)
If no mode is specified, EViews will attempt to auto-detect the delimiter. If an individual field contains double quotation marks, those marks will be escaped (replaced by "") and the entire field will be surrounded by double quotation marks. Delimiters are removed from the returned string, and all non-printing characters are replaced with spaces.
The following option for mode instructs EViews to return the contents of the file unmodified with no field preprocessing:
• “raw”
Example
string s1 = @wread("c:\temp\myfile.txt")
returns a string containing the contents of “c:\temp\myfile.txt”. The contents of the file are split into fields using autodetected delimiters, the delimiters are removed, and the fields are concatenated using space delimiters with non-printing characters replaced with spaces.
string s2 = @wread("c:\temp\myfile.txt", "raw")
returns a string containing the raw contents of “c:\temp\myfile.txt”.