Thread: Avoiding an external dll to printf

  1. #1
    Registered User
    Join Date
    Feb 2008

    Avoiding an external dll to printf


    My console application load a DLL via LoadLibrary. When calling this library the dll printf a few lines. Is it possible to avoid the dll to output printing at console from my program?


  2. #2
    Registered User
    Join Date
    Sep 2006
    You can print on a console window, without a dll. Whatever else the dll is doing for you, you'd have to replace that functionality, by using API calls.

    You'll need the source code changed, of course.

  3. #3
    Registered User
    Join Date
    Jan 2009
    Before you call the function, redirect stdin to a file (use freopen) and then change it back after calling the function. This function will create a file to redirect the text to, but you can just remove it afterwards.

    There are probably other/better ways to do this but this is the only one I can think of at the moment. You may also be able to just change the mode so that the writes to stdin fail but that is most likely undefined.

    EDIT: Come to think of it, I'm not 100% sure whether this method will work if the printf call is in another module, but it's worth a try.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math calculator and compiler errors
    By littlefermat245 in forum C Programming
    Replies: 2
    Last Post: 10-12-2009, 09:45 PM
  2. I have some questions :(
    By geekrockergal in forum C Programming
    Replies: 19
    Last Post: 02-01-2009, 09:44 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Replies: 4
    Last Post: 04-01-2003, 12:49 AM
  5. Ask about these "unresolved external symbol" error
    By ooosawaddee3 in forum C++ Programming
    Replies: 1
    Last Post: 06-29-2002, 11:39 AM

Tags for this Thread