+// ----------------------------------------------------------------------------
+// tiny helper wrapper around popen/pclose()
+// ----------------------------------------------------------------------------
+
+class wxStdioPipe
+{
+public:
+ // ctor parameters are passed to popen()
+ wxStdioPipe(const char *command, const char *type)
+ {
+ m_fp = popen(command, type);
+ }
+
+ // conversion to stdio FILE
+ operator FILE *() const { return m_fp; }
+
+ // dtor closes the pipe
+ ~wxStdioPipe()
+ {
+ if ( m_fp )
+ pclose(m_fp);
+ }
+
+private:
+ FILE *m_fp;
+
+ DECLARE_NO_COPY_CLASS(wxStdioPipe)
+};
+