LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display stderr to a specific CVI panel

hi !

In a subroutine, i need to display if an error occured.
I choose to do it with using stderr:
fprintf(stderr,"Can't read %s\n",file);

But, when i run the program, CVI open a new window in which it write the error (if it occur).
I jsut want to display all error to a text box in my control CVI-interface, and so i wonder if it is possible to redirect stderr to a specific text box, or if there is a function which display the error

(sorry for the bad english)
0 Kudos
Message 1 of 4
(3,213 Views)
You can't redirect stderr to a control.
Instead of using stderr, look at some options within your UIR user interface.
A. Use SetCtrlVal() to write the error message to a text control on your panel.
Or
B. Use MessagePopup() or ConfirmPopup() to display a dialog box with the error message, forcing the user to respond before continuing.
To find these functions and open their function panels:
1. Open a source code window and go to the subroutine you'll use to display the error message.
2. Press P to open the Find Function Panel window.
3. Enter the name (or part of the name)of the function you want to find.
4. From the function panel, enter your parameters and use the Declare Variable button (if needed) and the Insert Function Call button.
0 Kudos
Message 2 of 4
(3,213 Views)
I want to avoid using CVI functions in subroutines cause, the subroutines code could be exported to an unix station and it would be better if there is only the header on the code to modify
0 Kudos
Message 3 of 4
(3,213 Views)
Just pass an argument called errMsg or something to your sub-soutine and fill it with appropriate error inside the sub-routine. This way how do you display error is not handled by the sub-routine but by your calling program.
0 Kudos
Message 4 of 4
(3,213 Views)