aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 21:00:16 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2013-02-20 21:00:16 +0000
commit2e003fbbcfd67e6fadb1f882f3240cd4b542a052 (patch)
tree93a717d6dd2cf6ba0cb03c472e4497e7133d2273
parent964c3b3761646bcabd8ef1734da408b5b1cca807 (diff)
fopen and fclose -> sys_fopen and sys_fclose for recent pd
svn path=/trunk/externals/mrpeach/; revision=17047
-rw-r--r--net/tcpclient.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/tcpclient.c b/net/tcpclient.c
index bba25f1..7827001 100644
--- a/net/tcpclient.c
+++ b/net/tcpclient.c
@@ -47,6 +47,13 @@
#include <ws2tcpip.h> /* for socklen_t */
#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
+
#ifdef _MSC_VER
#define snprintf sprintf_s
#endif
@@ -305,7 +312,7 @@ static void tcpclient_send(t_tcpclient *x, t_symbol *s, int argc, t_atom *argv)
else if (argv[i].a_type == A_SYMBOL)
{
atom_string(&argv[i], fpath, FILENAME_MAX);
- fptr = fopen(fpath, "rb");
+ fptr = sys_fopen(fpath, "rb");
if (fptr == NULL)
{
post("%s_send: unable to open \"%s\"", objName, fpath);
@@ -322,7 +329,7 @@ static void tcpclient_send(t_tcpclient *x, t_symbol *s, int argc, t_atom *argv)
j = 0;
}
}
- fclose(fptr);
+ sys_fclose(fptr);
fptr = NULL;
if (x->x_verbosity) post("%s_send: read \"%s\" length %d byte%s", objName, fpath, j, ((d==1)?"":"s"));
}