Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Sergey Korneev

Suppressing external output.

This topic is 5157 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I''m writing a program that utilizes some functions from an old library(.lib file) (it deals with some AI and physics). The problem is, it creates some output via stdout, and my program can''t allow that. Is there any way to prevent output to stdout from external functions only?. E.g. my program has the following code: extern "C" { void _stdcall somefunc(); } and in project setting I link that library

Share this post


Link to post
Share on other sites
Advertisement
Can you not recompile the library or get the authors to recompile the library with the debug output suppressed?

You haven''t said what OS you are on, I''d guess it''s either Windows or DOS because they are the main ones which use .lib files.

In any case, either printf() should be harmless, or you can set standard output to go to the null device - NUL in DOS/Win - similar in effect to /dev/null in Unix (pretty much identical in fact).

I remember that in the old days when I used to use win95 strange things happened if I called printf() from a non console-mode app. But I haven''t seen it since and have sometimes run windows gui-mode apps with printf() in.

Mark

Share this post


Link to post
Share on other sites
quote:
Original post by markr
Can you not recompile the library or get the authors to recompile the library with the debug output suppressed?


I can. But it is commenting out 1200+ lines of text... And all of that - just to kill an output?
quote:

You haven''t said what OS you are on, I''d guess it''s either Windows or DOS because they are the main ones which use .lib files.

It is console application in Windows... At least it was until I run it in an program system emulator.

quote:
In any case, either printf() should be harmless, or you can set standard output to go to the null device - NUL in DOS/Win - similar in effect to /dev/null in Unix (pretty much identical in fact).

Yep, I do it now... but the problem is, I can''t use command line parameters. Do you know of any function that redirects stdout to nul(or to a useless file)?
quote:

I remember that in the old days when I used to use win95 strange things happened if I called printf() from a non console-mode app. But I haven''t seen it since and have sometimes run windows gui-mode apps with printf() in.

Mark

The root of my problems is that my program is not a stand-alone. It is run under another program, and that program prohibits output to stdout.





Share this post


Link to post
Share on other sites
You can use SetStdHandle to redirect the output. MSDN doesn''t say anything about allowing a null value or not but I''d give it a try.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!