Saturday October 21, 2017

       
      SteelArrow Basics
      SteelArrow Tags
  SteelArrow Functions
  SteelArrow Objects
  Advanced Topics
  WAS Overview
   
   
       
      Overview
  Code Samples
  Site Search
   
   
   


Get SteelArrow!     
  <SAREADFILE/>    
 
 
Secure Tag
Return to Tag List
 
The READFILE tag offers access to textual data files. The tag does not support absolute or '..' (parent) directory access. With this tag, files can only be read in the script directory. For security reasons, this is by design. The LINES attribute allows the data to be read from a regular text file, and stored to a named LIST object (one text line per element).

Note: READFILE supports "virtual" paths. These paths can be configured by the system administrator.

 
Attributes:
NAMEvariable to receive (textual) file data
FILEfile to access (relative to current directory or a virtual directory)
LOCKlock file during read? "yes" or "no" ("no" by default)
LINESis text file a list of lines? "yes" or "no" ("no" by default)

 
The following is an example of READFILE;
 
<SAREADFILE FILE="SomeFile.dat" NAME=entry LOCK="YES">
<SASET NAME=entry VALUE=Replace( entry, "is", "IS" )>

<!--- Write out the new data file --->
<SAWRITEFILE FILE="GuestBook.htm" ACTION="CREATE">
   #entry#
</SAWRITEFILE>


<!--- Read file and create a list with lines --->
<SAREADFILE FILE="SomeDir\SomeFile.dat" NAME=lines LINES="yes">

<!--- Write out the data with line #'s --->
<SAWRITEFILE FILE="SomeDir\SomeFile.dat">
   <SALOOP FROM=0 TO=entry.Length() NAME=count>
      Line:#count+1# #entry#</SALOOP>
</SAWRITEFILE>

<!--- Read file (using virtual path) --->
<SAREADFILE FILE="\common\Data\SomeFile.dat" NAME=entry2>

<!--- Write file (using virtual path) --->
<SAWRITEFILE FILE="\otherDir\SomeDir\SomeFile.dat">
   #entry2#
</SAWRITEFILE>






Copyright © 1998-2004 Tomahawk Technologies Inc.
Privacy Policy