Admin Production ni-theme
Current Publication

PrintTextFile

LabWindows/CVI

PrintTextFile

int PrintTextFile (char filename[], char outputFile[]);

Purpose

Prints a text file. You can direct the output to the printer or to a file. If you pass an empty string ("") to the outputFile parameter, this function prints the file to the default printer.

When you print a file, the following occurs:

  • Newline/carriage-return characters are honored.
  • Tabs expand according to the current state of the ATTR_TAB_INTERVAL attribute. You can modify this attribute with SetPrintAttribute. The default tab interval is four.
  • Text that extends beyond the end of the paper either truncates or wraps, depending on the state of the ATTR_TEXT_WRAP attribute. You can modify this attribute with SetPrintAttribute. The default setting is wrap.

While this function is printing, it blocks any other thread in your program that attempts to print.

Remember that LabWindows/CVI maintains only one copy of the print attributes you set with SetPrintAttribute. Thus, when you change a print attribute in one thread, the change affects printing functions you subsequently call in other threads.

Parameters

Input
Name Type Description
filename char [] Name of the file to print.

filename can be a complete pathname or a simple filename. If the name is a simple filename that contains no directory path, the file is loaded from the directory that contains the executable.
outputFile char [] Name of a file to which to direct the output.

If the name is not empty, the output is redirected to the file. If you pass an empty string (""), this function prints the file to the default printer.

If outputFile is a not a complete pathname, it is created relative to the current working directory.

Return Value

Name Type Description
status int Return value indicating whether the function was successful. A negative number indicates that an error occurred.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 4.0 and later