Redirecting I/O


Description

Application programs often call routines that display data on standard output, or accept data from standard input. This can be confusing at first in the VxWorks Shell, because the standard output and input streams are not necessarily directed to the same window as the shell. In fact the default setting in VxWorks is direct everything to the serial console(port). For example, if your application program does a printf, you will not see the item to be printed on the shell window.


Syntax

To designate a standard I/O device, execute the target routine ioGlobalStdSet() in WindSh. For example, the following sequence of commands resets standard input, standard output, and standard error to virtual I/O channel 0:

-> vf0=open("/vio/0",2,0) /* Creating virtual I/O Channel */

-> ioGlobalStdSet(0,vf0) /* Redirecting Standard In */

-> ioGlobalStdSet(1,vf0) /* Redirecting Standard Out */

-> ioGlobalStdSet(2,vf0) /* Redirecting Standard Error */

Notes:

o These sequence of instructions can be added to application source code for automatic execution at run time or can be stored in a script file to be loaded and executed from the shell.

o If after performing these steps IO still does not show up on the virtual console, you must reboot the VME board and start over.


Additional Information

  • Please see the VxWorks User's manual for further information.

    Return to Primary Table of Contents

    Return to VxWorks Account Configuration

    Last Updated: 09 November 1998
    Created by: Dan Eyassu
    eyassud@db.erau.edu