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,362 of 243,242   
   Bonita Montero to All   
   Re: is_binary_file()   
   08 Dec 25 13:51:49   
   
   From: Bonita.Montero@gmail.com   
      
   Am 07.12.2025 um 22:51 schrieb Richard Heathfield:   
   > 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.   
      
    From the glibc Reference Manual:   
      
   “The distinction between text and binary streams is only meaningful on   
   systems where text files   
   have a different internal representation. On Unix systems, there is no   
   difference between the   
   two; the ‘b’ is accepted but ignored.”   
      
      
   >   
   > ...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.   
   >   
      
   --- 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