Difference between revisions of "ReadTextFile"

m (adding doc status category)
Line 4: Line 4:
 
   
 
   
 
[[What's new in Analytica 4.0?]] >
 
[[What's new in Analytica 4.0?]] >
 +
 +
''(Requires Analytica Enterprise or Power Player)''
  
 
= ReadTextFile( filename'', showDialog ) =
 
= ReadTextFile( filename'', showDialog ) =
Line 12: Line 14:
  
 
From ADE, the dialog is never displayed.
 
From ADE, the dialog is never displayed.
 +
 +
== Treatment of End-of-line ==
 +
 +
Three different text-file formats are in common use, each differing in how new lines are delineated.  In Windows, the two-character sequence CRLF typically separates lines, while on Unix a single LF character is used, and on Macs a single CR is used.  Occassionally even Windows-based programs will use one of the other standards.
 +
 +
ReadTextFile insulates you from worrying about which standard is used.  In all cases, a single LF -- [[Chr]](10)
 +
-- appears in the result where newlines occur.
 +
 +
If a file contains a mixture of inconsistent line breaks, with LF or CRLFs occurring in some places, and CRs occurring elsewhere, the LF and CRLF breaks are identified with LFs, while the CRs -- Chr(13) -- are left as is.
  
 
= See Also =
 
= See Also =
Line 17: Line 28:
 
* [[CurrentDataDirectory]]
 
* [[CurrentDataDirectory]]
 
* [[WriteTextFile]]
 
* [[WriteTextFile]]
 +
* [[ReadCsvFile]]

Revision as of 19:49, 1 August 2007


What's new in Analytica 4.0? >

(Requires Analytica Enterprise or Power Player)

ReadTextFile( filename, showDialog )

Reads the contents of a text file into a text string.

The optional parameter, showDialog (new to 4.0) controls whether the file dialog appears. If not specified, then the dialog appears only if the file does not exist. To prevent this from showing (displaying an error instead) specify showDialog as false. To force the dialog to display, even if the file exists (i.e., as a way to give the user a chance to change the filename, while still providing a default name), specify showDialog as true.

From ADE, the dialog is never displayed.

Treatment of End-of-line

Three different text-file formats are in common use, each differing in how new lines are delineated. In Windows, the two-character sequence CRLF typically separates lines, while on Unix a single LF character is used, and on Macs a single CR is used. Occassionally even Windows-based programs will use one of the other standards.

ReadTextFile insulates you from worrying about which standard is used. In all cases, a single LF -- Chr(10) -- appears in the result where newlines occur.

If a file contains a mixture of inconsistent line breaks, with LF or CRLFs occurring in some places, and CRs occurring elsewhere, the LF and CRLF breaks are identified with LFs, while the CRs -- Chr(13) -- are left as is.

See Also

Comments


You are not allowed to post comments.