Skip to content

Commit

Permalink
Fix windows compiler warning
Browse files Browse the repository at this point in the history
Use fopen_s instead of fopen on Windows,
and check the error code.

Closes ros#32.
  • Loading branch information
scpeters committed Jan 26, 2016
1 parent bbcc914 commit d231a9d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,13 @@ void console_bridge::OutputHandlerSTD::log(const std::string &text, LogLevel lev

console_bridge::OutputHandlerFile::OutputHandlerFile(const char *filename) : OutputHandler()
{
#ifdef _MSC_VER
errno_t err = fopen_s(&file_, filename, "a");
if (err != 0 || !file_)
#else
file_ = fopen(filename, "a");
if (!file_)
#endif
std::cerr << "Unable to open log file: '" << filename << "'" << std::endl;
}

Expand Down

0 comments on commit d231a9d

Please sign in to comment.