HPlogo HP C++ Programmer's Guide: HP 9000 Series Workstations and Servers > Chapter 3 Compiling and Executing HP C++ Programs

Executing HP C++ Programs

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

After a program is successfully linked, it is in executable form.

To execute a program, enter the executable file name (either a.out or the file name you used following the -o option). For example, to execute an object file named my_executable, enter:

my_executable

The operating system searches for a file named my_executable according to its usual search rules, calls the loader utility, and then executes the program.

Redirecting stdin and stdout

By default, standard input (stdin) and output (stdout) for the program are assigned to the keyboard and display, respectively. You can direct standard input and output by using the shell's redirection notation. For example, to redirect standard input when you invoke my_executable, enter:

my_executable  < input_data

The < character reassigns standard input to the file input_data. You can redirect standard output in a similar fashion. For example,

my_executable > results

This command uses the character > to redirect standard output for my_executable to the file named results.

© Hewlett-Packard Development Company, L.P.