@@ -103,7 +103,6 @@ THE SOFTWARE.
103103
104104// Patch for Windows by Damien Loison
105105#ifdef _WIN32
106- # include < windows.h>
107106# define GNUPLOT_PCLOSE _pclose
108107# define GNUPLOT_POPEN _popen
109108# define GNUPLOT_FILENO _fileno
@@ -113,14 +112,6 @@ THE SOFTWARE.
113112# define GNUPLOT_FILENO fileno
114113#endif
115114
116- #ifdef _WIN32
117- # define GNUPLOT_ISNAN _isnan
118- #else
119- // cppreference.com says std::isnan is only for C++11. However, this seems to work on Linux
120- // and I am assuming that if isnan exists in math.h then std::isnan exists in cmath.
121- # define GNUPLOT_ISNAN std::isnan
122- #endif
123-
124115// MSVC gives a warning saying that fopen and getenv are not secure. But they are secure.
125116// Unfortunately their replacement functions are not simple drop-in replacements. The best
126117// solution is to just temporarily disable this warning whenever fopen or getenv is used.
@@ -141,9 +132,9 @@ THE SOFTWARE.
141132// "pgnuplot" is considered deprecated according to the Internet. It may be faster. It
142133// doesn't seem to handle binary data though.
143134// # define GNUPLOT_DEFAULT_COMMAND "pgnuplot -persist"
144- // On Windows, gnuplot echos commands to stderr. So we forward its stderr to the bit bucket.
145- // Unfortunately, this means you will miss out on legitimate error messages .
146- # define GNUPLOT_DEFAULT_COMMAND " gnuplot -persist 2> NUL "
135+ // The default install path for gnuplot is written here. This way the user doesn't have to add
136+ // anything to their %PATH% environment variable .
137+ # define GNUPLOT_DEFAULT_COMMAND " \" C: \\ Program Files \\ gnuplot\\ bin \\ gnuplot.exe \" -persist"
147138#else
148139# define GNUPLOT_DEFAULT_COMMAND " gnuplot -persist"
149140#endif
@@ -510,7 +501,7 @@ template<> struct TextSender< unsigned char> : public CastIntTextSender< unsigne
510501template <typename T>
511502struct FloatTextSender {
512503 static void send (std::ostream &stream, const T &v) {
513- if (GNUPLOT_ISNAN (v)) { stream << " nan" ; } else { stream << v; }
504+ if (std::isnan (v)) { stream << " nan" ; } else { stream << v; }
514505 }
515506};
516507template <> struct TextSender < float > : FloatTextSender< float > { };
@@ -1642,7 +1633,10 @@ struct FileHandleWrapper {
16421633 void fh_close () {
16431634 if (should_use_pclose) {
16441635 if (GNUPLOT_PCLOSE (wrapped_fh)) {
1645- std::cerr << " pclose returned error: " << strerror (errno) << std::endl;
1636+ perror (" pclose" );
1637+ // char msg[1000];
1638+ // strerror_s(msg, sizeof(msg), errno);
1639+ // std::cerr << "pclose returned error: " << msg << std::endl;
16461640 }
16471641 } else {
16481642 if (fclose (wrapped_fh)) {
0 commit comments