Utility Library Chapter 8
LabWindows/CVI Standard Libraries 8-44 © National Instruments Corporation
Return Codes
0Key has not been pressed.
1Key has been pressed.
Using This Function
The function returns 1 if a keystroke is available in the keyboard buffer, 0 otherwise. After a
keystroke is available, you should make a call to GetKey to flush the keyboard buffer.
Otherwise, KeyHit will continue to return 1.
Note: This function always returns 0 if you are running on UNIX and have done one of the
following.
• •
Selected Use hosts system’s standard Input/Output in the dialog box brought up
by selecting Options » Environment in the Project window; or
• Called SetStdioPort to set the port to HOST_SYSTEM_STDIO.
Example
/* flush any pending keystrokes */
while (KeyHit())
GetKey();
/* perform loop indefinitely until the user presses key */
while (!KeyHit()) {
}
LaunchExecutableint result = LaunchExecutable (char fileName[]);
Purpose
Starts running a program and returns without waiting for it to exit. The program must be an
actual executable; that is, you cannot launch commands intrinsic to a command interpreter.
Under Microsoft Windows the executable can be either an DOS or Windows executable,
including *.exe, *.com, *.bat, and *.pif files.
If you need to execute a command built into command.com such as copy, dir, and others,
you can call LaunchExecutable with the command
command.com /C DosCommand args, where DosCommand is the shell command you
would like executed. For example, the following command string would copy file.tmp from
the temp directory to the tmp directory:
command.com /C copy c:\\temp\\file.tmp c:\\tmp