ID Number: Q69220
1.10
MS-DOS
buglist1.10
Summary:
The Microsoft Programmer's WorkBench (PWB) contains three ways to run
a program:
1. You can choose Execute from the Run menu (and choose Command Line
from the Run menu to specify the command-line arguments).
2. You can choose Run DOS Command from the Run menu.
3. You can use the key combination "Arg textarg SHIFT+F9".
However, a problem occurs if a file is redirected as input into a
program that is executed using any of the methods above. The length of
the input file, from which STDIN will receive data, will be erased and
will receive a length of zero bytes. Thus, you cannot run a program
(command) from the Programmer's WorkBench that expects STDIN to be
redirected from a file. For example, if the command "PROG <INPUT.TXT"
is entered under Run DOS Command from the Run menu, the file INPUT.TXT
will be erased and have a length of zero. This problem occurs only in
DOS. The OS/2 version of the Programmer's WorkBench works correctly.
More Information:
Below is sample program that receives data redirected from a file, and
prints it to the screen. To demonstrate the problem, you can use the
sample program and do one of the following:
Choose Execute from the Run Menu
--------------------------------
1. Open the source file or program list of the program you want to
run.
2. Enter the command line option "<input.txt" under Command Line in
the Run menu. INPUT.TXT is the file that contains the input for the
program.
3. Choose Execute from the Run menu.
4. View the size of the file, INPUT.TXT.
Choose Run DOS Command from the Run Menu
----------------------------------------
1. Choose Run DOS Command from the Run menu.
2. Enter "prog <input.txt" where "prog" is the name of the executable
and INPUT.TXT is the name of the input file.
3. View the size of the file, INPUT.TXT.
Type "Arg textarg SHIFT+F9"
---------------------------
1. Press ALT+A.
2. Type in the command "prog <input.txt".
3. Press SHIFT+F9.
4. View the size of the file, INPUT.TXT.
One way to work around the problem is to create a batch file that
performs the command. Rather than running the program directly, the
program can be ran in the batch file with STDIN redirected from a
file.
Sample Code
-----------
#include <stdio.h>
void main(void)
{
int c;
for (c=getchar();!feof(stdin);c=getchar())
printf("%c",(char)c);
}
Microsoft has confirmed this to be a problem in the Programmer's
WorkBench version 1.10. We are researching this problem and will post
new information here as it becomes available.