Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

How Do I Pass a File Refnum to a Sub VI Containing a Write to Text File VI?

Primary Software: LabVIEW Development Systems>>LabVIEW Base Package
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Full Development System

Problem:
How do I Pass a File Refnum to a Sub VI Containing a Write to Text File VI?

Solution:
When you create a control by right clicking on the file input of a write to text file VI, a file path control appears. If you wish to append to a text file, rather than over write it, you must create a refnum control while generating your sub VI. In order to generate a refnum control in, follow these steps.
  1. Place a Write to File VI on your block diagram
  2. Right-click on the Refnum out » Create » Indicator
  3. Copy the indicator
  4. Right-click the copy, and select Change to a control
  5. Wire the control into the file input of the Write to Text File VI
  6. Rename input refnum in
Your VI should then look like this:
Refnum Creation
Continue to wire in the necessary controls and indicators, then follow the directions for creating a sub VI.

Developer Zone Tutorial: SubVIs

Attached are three files, the first SubVI.vi is the VI pictured above, the second Write to Text File With Headers, is an example of using a subVI with a Write to Text File VI, and the last file is the subVI used in that example.

Related Links:
Developer Zone Tutorial: SubVIs

Attachments:
SubVISubVI.vi
Write to Text File With Headers.viWrite to Text File With Headers.vi
Text File Header.viTextFile_Header.vi




Report Date: 11/25/2008
Last Updated: 12/09/2008
Document ID: 4ROCKDW8

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit