mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- If fread()/fwrite() fail to read/write any data because either the number
of records or the size of each record is zero, both now call clearerr() to avoid giving the caller the wrong impression that an EOF or error occured. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14927 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -16,6 +16,10 @@
|
||||
- Added code to the startup routine which allows you to monitor where command
|
||||
was started from and which parameters it was invoked with.
|
||||
|
||||
- If fread()/fwrite() fail to read/write any data because either the number
|
||||
of records or the size of each record is zero, both now call clearerr() to
|
||||
avoid giving the caller the wrong impression that an EOF or error occured.
|
||||
|
||||
|
||||
c.lib 1.191 (9.4.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fgetpos.c,v 1.6 2005-04-24 09:53:12 obarthel Exp $
|
||||
* $Id: stdio_fgetpos.c,v 1.7 2005-04-24 19:38:59 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -81,7 +81,7 @@ fgetpos(FILE *stream, fpos_t *pos)
|
||||
goto out;
|
||||
}
|
||||
|
||||
(*pos) = position;
|
||||
(*pos) = (fpos_t)position;
|
||||
|
||||
result = OK;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fread.c,v 1.5 2005-02-27 18:09:10 obarthel Exp $
|
||||
* $Id: stdio_fread.c,v 1.6 2005-04-24 19:38:59 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -137,6 +137,9 @@ fread(void *ptr,size_t element_size,size_t count,FILE *stream)
|
||||
SHOWVALUE(count);
|
||||
|
||||
SHOWMSG("either element size or count is zero");
|
||||
|
||||
/* Don't let this appear like an EOF or error. */
|
||||
clearerr((FILE *)file);
|
||||
}
|
||||
|
||||
D(("total number of elements read = %ld",result));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_fwrite.c,v 1.8 2005-04-04 10:09:57 obarthel Exp $
|
||||
* $Id: stdio_fwrite.c,v 1.9 2005-04-24 19:38:59 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -161,6 +161,11 @@ fwrite(const void *ptr,size_t element_size,size_t count,FILE *stream)
|
||||
|
||||
result = total_bytes_written / element_size;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Don't let this appear like an EOF or error. */
|
||||
clearerr((FILE *)file);
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user