Welcome,
Guest
. Please
login
or
register
. Did you miss your
activation email?
French forum
Home
Help
Search
Login
Register
SFML community forums
»
Help
»
General
»
[Solved] Disable SFML error messages
Print
Pages: [
1
]
Author
Topic: [Solved] Disable SFML error messages (Read 3339 times)
0 Members and 1 Guest are viewing this topic.
Raincode
Full Member
Posts: 118
[Solved] Disable SFML error messages
«
on:
January 02, 2017, 12:56:58 am »
Hi,
how can I stop SFML from writing to my console? In my case, I would like to handle sf::UdpSocket::bind() failing in my own way by using another Port. However, SFML always prints an error message to my console, which I do not want in this case.
«
Last Edit: January 02, 2017, 05:58:26 pm by Raincode
»
Logged
Laurent
Administrator
Hero Member
Posts: 32498
Re: Disable SFML error messages
«
Reply #1 on:
January 02, 2017, 08:39:52 am »
SFML prints to sf::err(), which you can redirect to something else than the console or even nothing. It's a standard std::ostream, so I let you Google (or search this forum) to find how to do it
Logged
Laurent Gomila - SFML developer
Hapax
Hero Member
Posts: 3379
My number of posts is shown in hexadecimal.
Re: Disable SFML error messages
«
Reply #2 on:
January 02, 2017, 02:01:16 pm »
My Plinth class that does this
Simply create a temporary object of this class during the activity that insists on outputting to the error stream. It automatically resumes where it was when the object is destroyed
#include <Plinth/Sfml/ErrBlocker.hpp>
int
main
(
)
{
// stuff before (errors are output as normal)
{
pl
::
Sfml
::
ErrBlocker
sfmlErrBlocker
;
// stuff while errors are blocked
}
// stuff after (errors are output as normal)
}
Logged
Selba Ward
-SFML drawables
Cheese Map
-Drawable Layered Tile Map
Kairos
-Timing Library
Grambol
*
Hapaxia Links
*
Raincode
Full Member
Posts: 118
Re: Disable SFML error messages
«
Reply #3 on:
January 02, 2017, 05:58:17 pm »
Hello,
thank you for your replies, I have a much better grasp of the SFML error printing now and the tools necessary to change it for my needs.
The premade class also works nicely, thank you.
Logged
Print
Pages: [
1
]
SFML community forums
»
Help
»
General
»
[Solved] Disable SFML error messages