TEXTOpen

Demonstrates how to open a text file.

Remarks

This example illustrates how to perform several operations on a text file.

Code

   local int tfid
   local string ReadLine
   local string file_name
   local mstring vlist    
   try
  
   vlist[1] = "The first line."
   vlist[2] = "The second line."
   vlist[3] = "The third line."
   file_name = TmpNam()
   call TEXTExport( file_name, vlist )
   tfid = TEXTOpen(file_name, "r")
   
   ReadLine = TEXTRead(tfid)
   
   While ReadLine <> "<EOF>"
   
       Print ReadLine
       ReadLine = TEXTRead(tfid)
       
   EndWhile
       
   Call TEXTClose(tfid)
   
   OnError
     print "Error: ", GetLastErrorMessage()
   EndOnError

Output

The first line.
The second line.
The third line.

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.