Skip to content

Commit

Permalink
修复windows下标准输出的重定向问题
Browse files Browse the repository at this point in the history
  • Loading branch information
liuanlin-mx committed Aug 6, 2022
1 parent f36e90a commit 687a5fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fasthenry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
#include <math.h>
#include "fasthenry.h"

#ifdef _WIN32
#define DEV_NULL " NUL "
#else
#define DEV_NULL " /dev/null "
#endif

fasthenry::fasthenry()
: _conductivity(5.8e7)
{
Expand Down Expand Up @@ -242,7 +248,7 @@ void fasthenry::calc_wire_lr(float w, float h, float len, float& l, float& r)

tmp += ".external N0 N1\n.freq fmin=1e8 fmax=1e8 ndec=1\n.end\n";

FILE *fp = popen("fasthenry > /dev/null", "w");
FILE *fp = popen("fasthenry > " DEV_NULL, "w");
if (fp)
{
fwrite(tmp.c_str(), 1, tmp.length(), fp);
Expand Down Expand Up @@ -302,7 +308,7 @@ void fasthenry::_call_fasthenry(std::list<std::string> wire_name)
tmp += ".freq fmin=1e9 fmax=1e9 ndec=1\n.end\n";


FILE *fp = popen("fasthenry > /dev/null", "w");
FILE *fp = popen("fasthenry > " DEV_NULL, "w");
if (fp)
{
fwrite(tmp.c_str(), 1, tmp.length(), fp);
Expand Down Expand Up @@ -337,7 +343,7 @@ void fasthenry::_call_fasthenry(const std::string& node1_name, const std::string


tmp += ".freq fmin=1e7 fmax=1e7 ndec=1\n.end\n";
FILE *fp = popen("fasthenry > /dev/null", "w");
FILE *fp = popen("fasthenry > " DEV_NULL, "w");
if (fp)
{
fwrite(tmp.c_str(), 1, tmp.length(), fp);
Expand Down

0 comments on commit 687a5fb

Please sign in to comment.