General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

FIN and FOUT (PMX commands)


Reading and writing text files in Part Maker (PMX) can be done by means of the FINPUT and FOUTPUT commands. Here is what is provided:

FOUTput(CREATE) filename
Creates a new text file having the given name (path may be included).

FOUTput(APPEND) filename
Opens an existing file, positioned such that new output goes at the end.

FOUTput() literal text
Writes one line of text (omitting leading blanks).

FOUTput(n)
Writes the n lines of text that follow the command or until the 5-character line %EOF% is encountered.

FOUTput(EVAL) expression
Writes the evaluation of the given expression

FOUTput(COMMENT) text
Writes the text with a comment character (`) at the beginning of the line

FOUTput(CLOSE)
Closes the output file.

FINput(OPEN) filename
Opens a text file for input.

FINput() varname
Reads one line into the given string variable.

FINput(CLOSE)
Closes the input file.

IF %EOF% THEN
...
END
This IF block will detect that the input file is positioned at its end.

For example, in PMX you can do this:
str er:="ER_COMPT.C"
card nerd:=7
FOUT(EVAL) "Part "+er+" has "+STR(nerd)+" deductions."

No kidding. It's true. This has been in PMX a long time, but someone forgot to document it. Part Maker Updates has been updated to include this information.


Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs