home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,363 of 243,242   
   Richard Harnden to Richard Heathfield   
   Re: is_binary_file()   
   07 Dec 25 22:49:52   
   
   From: richard.nospam@gmail.invalid   
      
   On 07/12/2025 21:51, Richard Heathfield wrote:   
   > On 07/12/2025 19:01, Richard Harnden wrote:   
   >> On 06/12/2025 01:05, Michael Sanders wrote:   
   >>> Am I close? Missing anything you'd consider to be (or not)   
   >>> needed?   
   >>   
   >> A text file is supposed to end with a '\n' (M$, of course, largely   
   >> ignores this convention), but a quick test could be:   
   >>   
   >> f = fopen(path, "rb");   
   >>   
   >> fseek(f, -1, SEEK_END);   
   >   
   > Not guaranteed to work with binary files...   
   >   
   > 7.19.9.2(3)   
   >   
   > A binary stream need not meaningfully support fseek calls with a whence   
   > value of SEEK_END.   
   >   
   > ...or text files.   
   >   
   > 7.19.9.2(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.   
   >   
      
   Ah, okay.  Thanks.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca