LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I generate a printer form feed in my CVI source code


0 Kudos
Message 1 of 2
(3,084 Views)
ANSI C defines the "\f" escape code as the form feed command for the standard ANSI C library functions like printf, however this is not a definition that is universally inherent to that escape code for all libraries.

The \f (form feed) escape character is not supported by CVI's PrintTextBuffer and PrintTextFile functions and do not cause the printer to execute any special functionality, instead just causing the printer to print out the visual representation of its ASCII value. PrintTextBuffer and PrintTextFile are not ANSI defined functions, and as such it is up to the CVI developers to define their behavior (much as in our Format I/O library).

What I can suggest instead is at any point in your text buffer you encounter a \f, break the buffer into substrings at thi
s token replacing the \f with null characters (remember, if you are using them, static strings always have null characters at the end) like this:

Buffer before: "Look Ma!\f No hands.\f"
Buffers after: "Look Ma!" -> "No hands."

Each time the PrintTextBuffer function encounters a null character it will cause the printer to form feed. Now, in another case, if you want a blank page to be fed from the printer, you can call PrintTextBuffer with an empty buffer to print, i.e. empty quotes -> "".

Jason F.
Applications Engineer
National Instruments
www.ni.com/ask
0 Kudos
Message 2 of 2
(3,084 Views)