Section files are text files (ASCII or UNICODE) which are split up into different sections using the following format:
[sectiontype sectionname]
data
[sectiontype sectionname]
data
This format was used to store all S_TOOLS-STx settings prior to version 3.0.
A section file is created with the option /Section.
The following script demonstrates the use of a section file item.
[macro section_file_example] // // create the section file item // #fname := set 'section_file_example.txt' #f := new file * '$#fname' /Section /Write if '$#f[?]' != 'file' then em -1 ; '$#mac - Failed to create the section file item' end // // create test data in a simple table // and write to the section file // #t := new table * $#t * '0 1 2 3 4 5 6 7 8 9' $#t * '10 11 12 13 14 15 16 17 18 19' $#f save $#t section section1 // // save the same data to another section // $#f save $#t section section2 // // open file using default text editor // system open '$#fname' // // list all sections in the file // if '$($#t /Delete)' > 0 then em $rc ; $#mac - Failed to empty table contents ($EMSG) end $#f list $#t if '$rc' > 0 em $rc ; $#mac - LIST failed ($EMSG) showitem $#t // // extract data from one of the file's sections // if '$($#t /Delete)' > 0 then em $rc ; $#mac - Failed to empty table contents ($EMSG) end $#f load $#t section section1 if '$rc' > 0 em $rc ; $#mac - LOAD failed ($EMSG) readtab $#t 0 #0 #1 #2 #3 #4 #5 #6 #7 #8 #9 if '$rc' > 0 em $rc ; $#mac - Failed to read table data butil 'msgbox msg ; The variable #1 contains the value "$#1"' // // delete file item // delete $#f exit