I inherited an ancient C program that was a Windows console application. The application connects to a data source and returns some values to the console. A very simple application. I had to make some changes and recompiled the code under Visual Studio 2008 C++. It compiled, linked and ran at the console perfectly. The problem is that the App is called by a Perl script that embeds the output from the console into html code. The old App works perfectly in the Perl and from the console. The new App runs fine from the console but when embedded in the Perl it runs but there is nothing in the resulting html code that is generated.
I know the Perl is working because when the old App name is inserted into the code the output contains the output from the console App.
The only thing I can think of is that there must be some compiler switch that I am missing that keeps it from working from the Perl script system call.

An easy way to find out if the problem is your new program is to run it from the command prompt and redirect the output to a file, such as c:\myprogram >myfile After the program finishes check the contents of the file to see if it contains the data you would expect.

When I redirect I get the output that I expect into a text file which can be type at the C:\ prompt and displays the data. The old application when embedded in the Perl script that generates the on the fly HTML works perfectly and writes the output of the application into the HTML between the <pre></pre> tags. But when I use the system call within the Perl to run the new application all I get between the <pre></pre> tags is a blank line.
I am stumped by this.

Well, I still don't know what the problem was. I went back to an ancient version of Developer Studio C++ 4.1, and rebuilt the project and it works. There must be something in the new generated code that is messing up the output in console applications. I now know the secret of rebuilding these old apps is to keep an ancient compiler installed.

This article has been dead for over six months. Start a new discussion instead.