LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Help redirecting dos program output under LabWindows/CVI

I am launching a DOS program from LabWindows/CVI and am attempting to re-direct the output into a file. A simple enough solution would seem to be to use the system funtion and redirect ....system(filename.exe > result.txt). When I do this however my dos program does execute, but the result file in nowhere to be found. I am running under Windows XP professional.
Has anyone seen this problem before? I also tried LaunchExecutable with similar results.
0 Kudos
Message 1 of 7
(4,508 Views)
Hi,

I was doing some tests here and I was able to direct the output of a CVI console app into a file. I used the system() function with a command to open up the command line and from there run the exe and direct the output to the file. Something like this:

system("cmd /c StdIOTest.exe > c:\\test1.txt");

I'm attaching here the exe so that you can test this out. As far as I know this should work with any console app.

Let me know how this goes.

Regards,

Juan Carlos
N.I.
Message 2 of 7
(4,509 Views)
Thanks ....this worked, the difference was the cmd within the system function call. If I ran it without the cmd , the DOS program would run correctly but the output was never directed into the output file. I put in the cmd /c and it worked correctly.

Thanks for your help !
0 Kudos
Message 3 of 7
(4,508 Views)
I happened to need the same functionality...
 
Unfortunately, in my case it did not work  😠
 
When I run the sw, it does create the file "test1.txt", and I do see the output being generated in a window, but the output does not get redirected into the newly created file.
 
Any ideas why?
 
Ray
 
 
Message 4 of 7
(4,428 Views)

A lot of old DOS programs don't use the operating system to write to the screen, they use BIOS calls or hit the hardware directly. If that is the case for your program, the screen output can't be redirected to a file.

Martin.

--
Martin
Certified CVI Developer
0 Kudos
Message 5 of 7
(4,406 Views)
Ray,
 
Take a look at this thread. This could be the reason:
 
 
Luis
0 Kudos
Message 6 of 7
(4,400 Views)

Hi Luis,

Yes, I think you understood what I am looking for.  I forgot to mention that I wanted to capture the standard output messages, not necessarily at the DOS level.

I will try what is proposed in the link and provide feedback.

Thanks,

Ray

Message 7 of 7
(4,382 Views)