file_scalar_ascii

Synopsis

file_scalar_ascii (file, offset, type)

Description

The file_scalar_ascii object reads ASCII scalar data from file starting at the position specified

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. See the example.

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


Example

ASCII file, data.dat, contains an integer and a float:

128 666.777

To get the integer and float values:

file data_file {
name = "data.dat";
};

int i_value => file_scalar_ascii(data_file, 0, 3);
int f_offset => file_skip_words(data_file, 0, 1);
float f_value => file_scalar_ascii(data_file, f_offset, 4);

Additional Examples

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