From: Owen Shepherd Date: Wed, 10 Oct 2012 15:01:48 +0000 (+0100) Subject: PDCLIB-13: fwrite did not reset it's offset after doing a buffer flush. X-Git-Url: https://pd.if.org/git/?p=pdclib.old;a=commitdiff_plain;h=7e71d1ccd9d7b1db85ce887ea15cf625025794ef PDCLIB-13: fwrite did not reset it's offset after doing a buffer flush. TODO: Evaluate if fwrite should move to using an offset stored inside the FILE structure Patch submitted by Rink Springer (complexity: trivial) --- diff --git a/functions/stdio/fwrite.c b/functions/stdio/fwrite.c index 89e9c03..90c8f44 100644 --- a/functions/stdio/fwrite.c +++ b/functions/stdio/fwrite.c @@ -44,6 +44,12 @@ size_t fwrite( const void * _PDCLIB_restrict ptr, size_t size, size_t nmemb, str return nmemb_i; } //lineend = false; + /* + * The entire buffer has been flushed; this means we have to + * reset our newline position as we have already written + * that part of the stream. + */ + offset = 0; } } }