Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How can I disable SFML error output?  (Read 4697 times)

0 Members and 1 Guest are viewing this topic.

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
How can I disable SFML error output?
« on: October 14, 2010, 12:33:40 pm »
With the current project I'm working on, I'd like to be able to keep my console window color coded and formatted to a specific way to successful and non-successful loading.

The problem is the error output built into the LoadFromFile methods makes my console window look quite messy (since everything is color coded and has a specific format, the gray line that is printed doesn't match the rest of the console).

Is there anyway I can disable this?

EDIT: To make things as clear as possible, this is what I'm talking about:
Quote

Image 0 loaded!
  Filepath: assets/gfx/default.png
  Identifier: default
Image 1 loaded!
  Filepath: assets/gfx/stick.png
  Identifier: stick
Image 2 loaded!
  Filepath: assets/gfx/delphine.png
  Identifier: player
Failed to load image "assets/gfx/fluffy-grass.pn". Reason : Unable to open file (I don't want this line showing)
Image 3 failed to load!
  Filepath: assets/gfx/fluffy-grass.pn
  Identifier: grass
Sound 1 loaded!
  Filename: assets/sfx/NOSOUND.ogg
  Identifier: NOSOUND

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How can I disable SFML error output?
« Reply #1 on: October 14, 2010, 12:38:08 pm »
You cannot disable SFML messages, but you can disable std::cerr, which is where SFML outputs its errors.

In SFML 2, messages are no longer sent to std::cerr, but to a specific ostream owned by SFML.
Laurent Gomila - SFML developer

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
How can I disable SFML error output?
« Reply #2 on: October 14, 2010, 12:43:08 pm »
I see...  Well then, off to the net to find out how to disable cerr.  Thanks for your help, Laurent.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
How can I disable SFML error output?
« Reply #3 on: October 14, 2010, 01:40:42 pm »
Code: [Select]
std::cerr.rdbuf(0);
;)
Laurent Gomila - SFML developer

inlinevoid

  • Newbie
  • *
  • Posts: 49
    • MSN Messenger - inlinevoidmain@gmail.com
    • AOL Instant Messenger - inlinevoid
    • View Profile
    • Email
How can I disable SFML error output?
« Reply #4 on: October 14, 2010, 08:47:04 pm »
Thanks. :D

 

anything