delorie.com/archives/browse.cgi | search |
From: | eyal DOT ben-david AT aks DOT com |
To: | heretic AT polbox DOT com |
cc: | djgpp AT delorie DOT com |
Message-ID: | <422564D6.005C61DE.00@aks.com> |
Date: | Wed, 16 Jul 1997 18:54:27 +0200 |
Subject: | Re: fread/fwite return value |
Mime-Version: | 1.0 |
On 7/16/97 6:05:33 PM heretic wrote: >So, I wanted to have error checking and I wrote something like > > if ( fread(blah,blah,blah) == -1 ) > { > oh_no_error (); > } > >But compiler warned that I am comparing unsigned and signed. And it >was right: size_t is unsigned long! Anyone knows how fread or fwrite >can return -1 on error while its return value is unsigned? > cast . now it is 0xFFFFFFFF. if (fread (...) == (size_t) -1) { ..... } Eyal.
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |