]> pd.if.org Git - pdclib/blobdiff - functions/stdio/fopen.c
Added some functions.
[pdclib] / functions / stdio / fopen.c
index 9a01fe3debc8f225a5bdd1244ba85814355589f1..96fdcc19803bb709efa65f28f61107ccb65cf57b 100644 (file)
@@ -80,8 +80,10 @@ struct _PDCLIB_file_t * fopen( const char * _PDCLIB_restrict filename, const cha
     /* Adding to list of open files */
     rc->next = _PDCLIB_filelist;
     _PDCLIB_filelist = rc;
-    /* Setting buffer, and mark as internal. TODO: Check for unbuffered? */
+    /* Setting buffer, and mark as internal. TODO: Check for unbuffered */
     if ( ( rc->buffer = malloc( BUFSIZ ) ) == NULL ) goto fail;
+    rc->bufsize = BUFSIZ;
+    rc->bufidx = 0;
     rc->status |= ( _PDCLIB_LIBBUFFER | _PDCLIB_VIRGINSTR );
     /* TODO: Setting mbstate */
     return rc;