HTBasic Help
×
Menu
Index

CAT Example

10    DIM Files$(80)[80]
20    CONFIGURE LONGFILENAMES OFF
25                CONFIGURE LONGCATDATES OFF
30    Directory$="C:\"
40    CLEAR SCREEN
50    PRINT "Major CAT test program instructions: "
60    PRINT
70    PRINT
80    PRINT "Type CONT to continue"
90    PRINT "when paused."
100  DISP "*** Cat TEST ****"
110  New("Regular CAT")
120  CAT Directory$
130  
140  New("CAT to printer")
150  CAT Directory$ TO #10  !CAT to the Windows default printer.
160  PRINTER IS CRT
170  
180  CAT Directory$;NO HEADER   !CAT without the header.
190
200  New("Just the file names")
210  CAT Directory$;NAMES       !CAT the names of the files only.
220  
230  New("Extend option")
240  CAT Directory$;EXTEND      !CAT with the EXTEND option to suppress the SRM format.
250  
260  New("Long file names")
270  CONFIGURE LONGFILENAMES ON
280  CAT Directory$             !CAT with longfilenames on.
290  CONFIGURE LONGFILENAMES OFF
300  
310  New("CAT *.txt files.")
320  CAT Directory$&"*.txt"     !Look for only the files with *.txt extensions.
330  
340  New("CAT *.txt to string test")
350  CAT Directory$&"*.txt" TO Files$(*)   !CAT to a file.
360  PRINT "The first 10 text files in "&Directory$
370  FOR Loop=1 TO 10
380    PRINT Loop,File$(Loop)
390  NEXT Loop
400  
410  New("Number of files")
420  CAT Directory$;NAMES,COUNT Count  !Find the number of files in the directory.
430  PRINT "The number of files in "&Directory$&" is";Count
440  
450  New("CAT the file names, skiping the first 10")
460  CAT Directory$;NAMES,SKIP 10   !CAT skipping the first ten files.
470  
480  New("Files that start with 'T'")
490  CAT Directory$;SELECT "T"      !CAT only the files starting with T.
500  New("Test complete")
510  END
520  SUB New(Msg$)
530    PAUSE
540    CLEAR SCREEN
550    DISP Msg$
560  SUBEND