Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

gets

gets( 
g_variableName 
[ p_inputPort ] 
) 
=> t_string / nil

Description

Reads a line from the input port and stores the line as a string in the variable. This is a macro.

The string is also returned as the value of gets. The terminating newline character of the line becomes the last character in the string.

Arguments

s_variableName

Variable to store input string in. You can also specify nil instead of a variable name.

p_inputPort

Name of input port; piport is used if none is given.

Value Returned

t_string

Returns the input string when successful.

nil

When EOF is reached. s_variableName stores the last value returned (that is, nil).

Examples

Assume the test1.data file has the following first two lines:

    #This is the data for test1
0001 1100 1011 0111
p = infile("test1.data")     => port:"test1.data"
gets(s p) => "#This is the data for test1\n"
gets(s p)
=> "0001 1100 1011 0111\n"
s
=> "0001 1100 1011 0111\n"
var = gets(nil port) -- read into var from port
var = gets(nil) -- read into var from <stdin>

Related Topics

getc

getchar

infile


Return to top
 ⠀
X