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

outfile

outfile( 
S_fileName 
[ t_mode ] 
[ g_openHiddenFile ]
) 
=> p_outport / nil

Description

Opens an output port ready to write to a file.

The file can be specified with either an absolute path or a relative path. If a relative path is given and the current SKILL path setting is not nil, all directory paths from SKILL path are checked in order, for that file. A path that is anchored to the current directory, for example, ./, ../, or ../../.., and so on, is not considered as a relative path. If found, the system overwrites the first updatable file in the list. If no updatable file is found, it places a new file of that name in the first writable directory.

If the optional g_openHiddenFile argument (which is intended to be used on Windows only) is specified, the system will be forced to open a Windows hidden file. The g_openHiddenFile must be used for openning existing Windows hidden files only. If the named Windows hidden file does not exist (including the current SKILL path), outfile will fail. In addition, the t_mode option must also be specified (to either w or a only) if g_openHiddenFile is given.

Arguments

S_fileName

Name of the file to open or create.

t_mode

If the mode string t_mode is specified, the file is opened in the mode requested. If t_mode is a, an existing file is opened in append mode. If it is w, a new file is created for writing (any existing file is overwritten). The default is w.

g_openHiddenFile

If specified to non-nil, the named Windows hidden file is forced to open. This argument must be used for Windows hidden files only.

Value Returned

p_outport

An output port ready to write to the specified file.

nil

If the named file cannot be opened for writing or the named Windows hidden file does not exist (including the current SKILL path).

An error is signaled if an illegal mode string is supplied.

Examples

p = outfile("/tmp/out.il" "w")    
=> port:"/tmp/out.il"
outfile("/bin/ls")  
=> nil

To force opening a Windows hidden file t_mode must also be specified.

outfile( "aHiddenFile" "w" t)

Related Topics

close

drain

getSkillPath

infile


Return to top
 ⠀
X