file_obj

Synopsis

file_obj(file, offset, type, columns, ascii_binary [,stride])

Description

The file_obj object reads an ASCII or a binary array from the file object. It starts reading data at the offset position which is specified in bytes, and it reads the number of values corresponding to the dimensionality of the referencing object. If the dimensionality is not specified, it reads until the end of file. If the dimensionality is specified and the end of file is reached before the target object is filled, an error is reported.

Note: file_obj is the superclass of the file_obj_bin, file_scalar_ascii, and file_array_ascii objects described later in this chapter.

Parameters

file

Object of type FILE.file that identifies the file that will be accessed. Note that this is not a string holding the filename.

offset

int. Specifies, in bytes, an offset from the beginning of the file.

Type

int. type specifies type of data:

Value

Data type

0

Byte

1

Character

2

Short

3

Integer

4

Float

5

Double


columns

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. This parameter is not used for binary files.

ascii_binary

0 for ASCII files, 1 for binary files and 2 for portable binary (XDR) files. Alternatively you can specify this parameter using one of the strings: "ascii", "binary" or "xdr".

stride

An optional integer value that specifies how many "strides" must be taken to get to the next data value. The value is interpreted in terms of elements, not bytes. It is relevant only for binary files, if is omitted, 1 is assumed.1});

Example

v/dv_examp/file_ucd.v
v/dv_examp/file_unif.v

File

v/file.v

See also related modules

File Objects Overview
file_array_ascii
file_find_expr
file_obj
file_obj bin
file_scalar_ascii
file_skip_lines
file_skip_words