file_array_ascii
Synopsis
file_array_ascii(file, offset, type, columns)
Description
file_array_ascii reads the number of words corresponding to the dimensionality of the referencing object. It reports an error if it finds the end of file before the target object is filled. The words must be separated by spaces.
Parameters
Object of type FILE.file that identifies the file that will be accessed. Note that this is not a string holding the filename. See the example.
int. An array of 1s and 0s that represents words in the lines of an ASCII file. It indicates whether or not to read the words.
int. An optional integer value that specifies how many "strides" must be taken to get to the next data value. It is relevant only for binary files, if is omitted, 1 assumed. It is ignored in file_array_ascii.
Example
ASCII file, col_data.txt , contains three columns of float numbers starting from line 100. There are 200 lines containing the array.
You want to extract the second and third components of the array:
FILE.file data_file{
name = "col_data.txt";
};
int offset => file_skip_lines (data_file, 0, 100);
float values[200][2] =>
file_array_ascii(data_file,offset, 4, {0, 1, 1});Additional Examples
v/dv_examp/file_ucd.v
v/dv_examp/file_unif.vFile
See also related modules