GHS Port Reference Center
Information for maritime designers, engineers and builders Maintained by Creative Systems, Inc., Creators of GHS Click here for information about GHS and other fine marine software. |
|
`Reading and parsing data from a separate text file `Download FORM.TXT to use with this example run file. template info "About the Read (Data) Command" "A special mode is started by READ (DATA) filename and ended by READ (DATA)" "OFF. While this READ DATA mode is active, the READ command inputs sequential" "data items from the current filename line to fill each specified variable," "delimited by comma, space, or tab characters (unless /DELIM had specified a" "different delimiter); any non-filled variables are set empty. Input advances" "to the next line after filling the final variable only if the current line is" "now empty or /SKIP is present. However, if /LINE is used, the rest of the" "line is read unmodified into each variable before advancing. Testing whether" "the last line was emptied (and a new line was started) can be done using the" "IF [NOT] EOL THEN ... structure. Testing for the end of the data file can be" "done using the IF [NOT] EOF THEN ... structure." / .info proj read variable(str) w1, w2, w3, w4, w5, w6, w7 ,w8, w9, w10, w11 macro readln .readword(11,1) 1 if {w1} = "LENGTH" then ,, if {w4} = "BREADTH" then ,, if {w7} = "DEPTH" then exit .lbd / macro readword if %1 = 11 then read w%1 /skip else read w%1 / macro lbd me Depth: {w11}, Waterplane Length: {w3}, Waterplane Breadth: {w6} / read(data) form.txt me (report) parse.txt .readln(150,1) 1 me (report) off read(data) off edit parse.txt |
Add a free link to your site |