aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 20:59:08 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 20:59:08 +0000
commit964c3b3761646bcabd8ef1734da408b5b1cca807 (patch)
tree57026ea5fc7305d73dcf66389ab6b7be578b130a /net
parent7e56a0e32cb399151013dfddc187c31aa9ef077e (diff)
fopen and fclose -> sys_fopen and sys_fclose for recent pd
svn path=/trunk/externals/mrpeach/; revision=17046
Diffstat (limited to 'net')
-rw-r--r--net/tcpsend.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/tcpsend.c b/net/tcpsend.c
index 7aef491..5af788c 100644
--- a/net/tcpsend.c
+++ b/net/tcpsend.c
@@ -20,6 +20,13 @@
#include <netdb.h>
#endif
+/* support older Pd versions without sys_open(), sys_fopen(), sys_fclose() */
+#if PD_MAJOR_VERSION == 0 && PD_MINOR_VERSION < 44
+#define sys_open open
+#define sys_fopen fopen
+#define sys_fclose fclose
+#endif
+
static t_class *tcpsend_class;
typedef struct _tcpsend
@@ -163,7 +170,7 @@ static void tcpsend_send(t_tcpsend *x, t_symbol *s, int argc, t_atom *argv)
#ifdef DEBUG
post ("tcpsend fname: %s", fpath);
#endif
- fptr = fopen(fpath, "rb");
+ fptr = sys_fopen(fpath, "rb");
if (fptr == NULL)
{
post("tcpsend: unable to open \"%s\"", fpath);
@@ -185,7 +192,7 @@ static void tcpsend_send(t_tcpsend *x, t_symbol *s, int argc, t_atom *argv)
break;
}
}
- fclose(fptr);
+ sys_fclose(fptr);
fptr = NULL;
post("tcpsend: read \"%s\" length %d byte%s", fpath, j, ((d==1)?"":"s"));
}