• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Numeric Values
      • String Values
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
        • File Statement
        • File.open Function
        • File.close Function
        • File.read Function
        • File.write Function
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • StringWriter Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Text Templates
    • Templated Reporting System
    • HTML, Markdown, and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataManager>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

File.open Function

Format
b = file_handler.open(file_nameʃ, update ‖ append ‖ createʅ);
Description
The File.open function associates the File file_handler to a text file on the disk. The file_name argument is a string expression containing the file name of the file to be associated with the file. This function is equivalent to the setfile function.
Using the keyword update, append or create is optional. If no keyword is used, the file is opened in update mode.
If update is used, you are positioned at the beginning of the file. If append is used, the file's contents are not changed and you are positioned at the end of the file. If create is used, all previous content in the file is removed and you are positioned at the beginning of the file.
If create or append is used and the file does not already exist, a new empty file will be created. If update is used and the file does not already exist, the function will fail and return 0.
Return Value
The function returns a logical value of 1 (true) if the new file is successfully assigned and 0 (false) otherwise.
File Example
File household_report_file;

household_report_file.
open("Household Report.txt", create);
See also: File Object, File.close Function, SetFile Function