file_array_ascii


Synopsis


file_array_ascii(file, offset, type, columns)

Description

The file_array_ascii object reads an ASCII array from file starting at the position specified by an offset in bytes. The integer type specifies type of data:

Value

 

Data type

 

0

Byte

1

Character

2

Short

3

Integer

4

Float

5

Double

 

columns is 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.

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.

Example

ASCII file, data , 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 data_file{
name = "data";
};


int offset => file_skip_lines (data_file, 0, 100);
float values[200][2] =>
file_array_ascii(data_file,offset, 4, {0, 1, 1});