Re: uncompressing data in memory
From: Dan Pop (Dan.Pop_at_cern.ch)
Date: 06/22/04
- Next message: kal: "Re: Pointer Guide"
- Previous message: Dan Pop: "Re: [OT] simple malloc() problem"
- In reply to: Jack Klein: "Re: uncompressing data in memory"
- Next in thread: Jack Klein: "Re: uncompressing data in memory"
- Reply: Jack Klein: "Re: uncompressing data in memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 22 Jun 2004 12:33:25 GMT
In <g36fd0hr60e5cm0dju6hail1pgkn0bf93h@4ax.com> Jack Klein <jackklein@spamcop.net> writes:
>On Tue, 22 Jun 2004 00:51:24 +0200, Slaanesh <slaanesh@no-log.org>
>wrote in comp.lang.c:
>
>>fseek(file, 0, SEEK_END);
>
>If your file contains compressed data, it is almost certainly binary
>and not text. Yet you have opened it in text mode. Also, SEEK_END
>has undefined behavior for binary files,
Chapter and verse, please. AFAICT, "need not meaningfully support" is
FAR from invoking undefined behaviour.
>although it might not work all that well for text files either.
It is *guaranteed* to work for text streams, when offset is 0. Otherwise,
using SEEK_END is genuine undefined behaviour (violation of a "shall"):
4 For a text stream, either offset shall be zero, or offset shall
be a value returned by an earlier successful call to the ftell
function on a stream associated with the same file and whence
shall be SEEK_SET.
Dan
-- Dan Pop DESY Zeuthen, RZ group Email: Dan.Pop@ifh.de
- Next message: kal: "Re: Pointer Guide"
- Previous message: Dan Pop: "Re: [OT] simple malloc() problem"
- In reply to: Jack Klein: "Re: uncompressing data in memory"
- Next in thread: Jack Klein: "Re: uncompressing data in memory"
- Reply: Jack Klein: "Re: uncompressing data in memory"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|