LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using stdin/stdout with LabVIEW

When I'm debugging a C++ DLL, I use AllocConsole() to open a console for the calling process, redirect stdout with freopen(), then I use printf() generously.  This also works when I load my DLL in LabVIEW.  I was curious if stdin, stdout, and stderr point anywhere by default in LabVIEW.  Can I access these streams in some way from LabVIEW without redirecting?  If anyone has experimented with this, let me know!
 
Thx!!
 
0 Kudos
Message 1 of 6
(6,702 Views)
Hi,


I did some experimenting with the AllocConsole(), but I don't think much useful can be done with it..


You can use AllocConsole, and WriteFile, etc. to output strings to a new console. But I never succeeded in outputting LabVIEW data to it's command line. I even tried the redirect piping example from the MSDN, but it didn't work. Normal windows applications just aren't supposed to do this.


I think CGI works by outputting data to the command line, and I think CGI is included in the internet connectivity toolkit. So perhaps by abusing the CGI you can use the stdin, stdout.


What would you like to achieve?


Regards,


Wiebe.



"clnorris" <x@no.email> wrote in message news:1146872408717-361573@exchange.ni.com...
When I'm debugging a C++ DLL, I use AllocConsole() to open a console for the calling process, redirect stdout with freopen(), then I use printf() generously.&nbsp; This&nbsp;also works when I load my DLL in LabVIEW.&nbsp; I was&nbsp;curious if stdin, stdout, and stderr point anywhere by default in LabVIEW.&nbsp; Can I access these streams in some way from LabVIEW without redirecting?&nbsp; If anyone has experimented with this, let me know!
&nbsp;
Thx!!
&nbsp;
0 Kudos
Message 2 of 6
(6,693 Views)

I'm using a console to display printf() output from a DLL that I'm debugging when it's loaded in LabVIEW.  This works great.  I wanted to see if the streams are going somewhere useful by default in LabVIEW or at the very least confirm that redirecting stdin/stdout won't mess anything up in LabVIEW's process.

Thanks for the feedback!

0 Kudos
Message 3 of 6
(6,670 Views)


@clnorris wrote:

I'm using a console to display printf() output from a DLL that I'm debugging when it's loaded in LabVIEW.  This works great.  I wanted to see if the streams are going somewhere useful by default in LabVIEW or at the very least confirm that redirecting stdin/stdout won't mess anything up in LabVIEW's process.

Thanks for the feedback!



Windows dinstinguishes between two basic types of applications (Just leave out Active X and .Net for the moment). One is a console application and the other is a GUI application. GUI applications by default do NOT have any stdin/stdout and as far as I know does LabVIEW not do anything to change this. In order to have some sort of stdin/stdout functionality in a GUI application you have to explicitedly allocate a console and associate some streams with its stdin/stdout in order to have printf and friends do something meaningful. I believe that printf and friends otherwise just are redirected to NUL.

Rolf Kalbermatter

Message Edited by rolfk on 05-12-2006 11:41 AM

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(6,664 Views)
Windows knows two types of apps; gui or console.

This is controled by a bit in the binary.

If the app is console windows creates a console and opens streams when starting the app.

MS has a tool, named editbin, that can toggle this bit.

  • EditBin MyProgram.exe /SUBSYSTEM:CONSOLE
  • EditBin MyProgram.exe /SUBSYSTEM:WINDOWS

Make the LabVIEW app console and all printf's or couts appear in the console.


editbin is delivered with visual studio. perhaps there are other sources to. it needs the visual studio linker.

It can also be used to set other nice stuff in binaries.


Okko Willeboordse

0 Kudos
Message 5 of 6
(6,461 Views)