diff --git a/eeschema/netlist_exporters/netlist_exporter_generic.cpp b/eeschema/netlist_exporters/netlist_exporter_generic.cpp index b0e6bf2943..fbdbd68e68 100644 --- a/eeschema/netlist_exporters/netlist_exporter_generic.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_generic.cpp @@ -31,6 +31,7 @@ #include #include #include +#include static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 ); @@ -41,12 +42,19 @@ bool NETLIST_EXPORTER_GENERIC::WriteNetlist( const wxString& aOutFileName, unsig for( unsigned ii = 0; ii < m_masterList->size(); ii++ ) m_masterList->GetItem( ii )->m_Flag = 0; + // declare the stream ourselves to use the buffered FILE api + // instead of letting wx use the syscall variant + wxFFileOutputStream stream( aOutFileName ); + + if( !stream.IsOk() ) + return false; + // output the XML format netlist. wxXmlDocument xdoc; xdoc.SetRoot( makeRoot( GNL_ALL ) ); - return xdoc.Save( aOutFileName, 2 /* indent bug, today was ignored by wxXml lib */ ); + return xdoc.Save( stream, 2 /* indent bug, today was ignored by wxXml lib */ ); }