Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: How to read a data file whose size is unknown in C? Date: Thu, 13 Aug 2015 13:39:12 -0700 Organization: None to speak of Lines: 26 Message-ID: References: <7b7a215a-b72a-48ba-bbdc-ddc22ad8c5b7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="8821"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18g8GsX6Zjwsr79/9avXVCO" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:k5q7jPint2ch2otj5JBj3f5Bt88= sha1:3qmrtr6Vwsa90KDgHwMM2qD/now= Xref: csiph.com comp.lang.c:67332 glen herrmannsfeldt writes: > Bartc wrote: >> On 13/08/2015 01:04, Richard Heathfield wrote: >>> On 13/08/15 00:44, Bartc wrote: > >>>> Except the file itself could grow, shrink or be updated at the same >>>> time. Reading a file into memory could actually be impossible! > >>> Right. Again, that's why this is very OS-specific. My original answer >>> was based on the assumption that the file is well-behaved and stands >>> still while you're trying to measure it. > >> But if we're making assumptions, why not also that fseek and ftell work >> as expected? > > How do you expect them to work? As specified by POSIX. [...] -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"