01-16-2024 10:59 AM
I have a fun issue I need to resolve. I have a command line utility written in CVI 2020 that takes a file name as an argument and converts the data in that file to another format. Specifially:
LBXWriter myfile.bgData -o myfile.lbx
It opens the .bgData file and writes a new .lbx file. Not complicated. As it runs it spits a few status messages out to the console using fprintf(stderr, ...).
Okay, so that's been working a while now. I want to call it from within a LabWIndows 2020 GUI application. I'm using LaunchExecutableEx() and I pass it the executable name with the command line arguments. When it executes, a black window pops up with the status messages as they get generated and the desired output files appear. So far, so good.
I then added a command line option to suppress the status output. The hope is to get rid of the visible output window because it's distracting. When I put a command line argument like "-quiet" in the code so that it simply doesn't call fprintf(), the code still appears to open the input file but it simply doesn't write the output file. It's as if writing to stderr somehow enables the capability to write output files.
Has anyone ever seen anything like this?
Thanks!
01-17-2024 04:52 AM
Are you sure you use the built in fprintf() function and not some private wrapper in which you disabled the output when the -quiet flag is set? I have had similar issues in the past, not specifically LabWindows/CVI related and it usually was something like that, which was prompted by a feature request that I tried to solve in a quick and easy fix that eventually ended up being more complicated than first thought.
01-23-2024 02:03 AM
If your main problem is that the printf output window pops up, you can use the stdio functions to keep it in the background without changing the rest of the code.