* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.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
* * ** * * * *