diff options
Diffstat (limited to 'pd/src/m_binbuf.c')
-rw-r--r-- | pd/src/m_binbuf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c index 9e96d68b..fbae4be5 100644 --- a/pd/src/m_binbuf.c +++ b/pd/src/m_binbuf.c @@ -757,6 +757,25 @@ int binbuf_read(t_binbuf *b, char *filename, char *dirname, int crflag) return (0); } + /* read a binbuf from a file, via the search patch of a canvas */ +int binbuf_read_via_canvas(t_binbuf *b, char *filename, t_canvas *canvas, + int crflag) +{ + int filedesc; + char buf[MAXPDSTRING], *bufptr; + if ((filedesc = canvas_open(canvas, filename, "", + buf, &bufptr, MAXPDSTRING, 0)) < 0) + { + error("%s: can't open", filename); + return (1); + } + else close (filedesc); + if (binbuf_read(b, bufptr, buf, crflag)) + return (1); + else return (0); +} + + /* old version */ int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname, int crflag) { |