This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: B20: large fread() calls fail
> Hello Nathan,
>
> Chances are it is the difference between text and binary mode:
> The EOL character gets expanded into CRLF when you read, so more
> characters are read than the stat() is telling you. It sometimes works
> because of the way memory is allocated and whether or not you
> overwrite something important when you overflow the buffer.
Hmm.. a good possibility, but I don't think it's correct. What I did was use
an #ifdef on the fopen() that looked like this:
#ifdef CYGNUS /* CYGNUS is defined with a -DCYGNUS at compile time */
if( (fp = fopen(filename, "rb")) == NULL ) /* use binary mode w/ cygwin */
#else
if( (fp = fopen(filename, "r")) == NULL )
#endif
> Also I would note that you have a couple of places you can
> lose a bunch of memory - those places you return after allocating
> memory but are unable to fill it.
Good eye, I've cought those. Those weren't the problem either :\
Here are the file sizes for the files that aren't loading:
-rw-r--r-- 1 500 everyone 142004 Jul 30 20:12 help.remorts.new
-rw-r--r-- 1 500 everyone 41358 Aug 6 01:16 help.mortskills.new
-rw-r--r-- 1 500 everyone 85336 Jul 4 23:03 woodland.are
-rw-r--r-- 1 500 everyone 7206 Jul 26 13:22 Lancelot.are
What's odd is that there are larger files than these that seem to have no
problems loading, such as the following file:
-rw-r--r-- 1 500 everyone 320797 Jun 26 17:10 shay.are
As you can see, it's larger than the above areas combined.
Nathan Strong
gblues@jps.net
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com