qb45advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
LTRIM$ Function Programming Example
  QuickSCREEN      Details     Example      Contents      Index
──────────────────────────────────────────────────────────────────────────────
LTRIM$ Function Programming Example
 
This example copies a file to a new file, removing all leading and
trailing spaces.
                                ----- Note -----
To run this example, you must supply the name of an existing text file.
                                ----------------
 
CLS                          ' Clear screen
' Get the file names.
INPUT "Enter input file name:", InFile$
INPUT "Enter output file name:", OutFile$
 
OPEN InFile$ FOR INPUT AS #1
OPEN OutFile$ FOR OUTPUT AS #2
 
' Read, trim, and write each line.
DO WHILE NOT EOF(1)
   LINE INPUT #1, LineIn$
   ' Remove leading and trailing blanks.
   LineIn$ = LTRIM$(RTRIM$(LineIn$))
   PRINT #2, LineIn$
LOOP
 
CLOSE #1, #2
 
END