From: already5chosen@yahoo.com   
      
   On Tue, 9 Dec 2025 16:29:39 -0500   
   James Kuyper wrote:   
      
   > On 2025-12-06 20:37, James Kuyper wrote:   
   > ...   
   > > "Data read in from a text stream will necessarily compare equal to   
   > > the data that were earlier written out to that stream only if: the   
   > > data consist only of printing characters and the control characters   
   > > horizontal tab and new-line; no new-line character is immediately   
   > > preceded by space characters; and the last character is a new-line   
   > > character." (7.23.2p2).   
   > >   
   > > I believe it therefore makes sense to consider something to be a   
   > > text file if it meets those requirements, and otherwise is a binary   
   > > file. Note that the last requirement implies that an empty file   
   > > cannot qualify as text - at a minimum, it must contain a new-line   
   > > character.   
   > >   
   > > This implies the use of the isprint() function; the only other   
   > > characters you need to handle specifically are '\t', '\n', and ' '.   
   > > Since the result returned by isprint() is locale-dependent, the   
   > > program should, at least optionally, use setlocale().   
   >   
   > I just realized an annoying complication. Whatever   
   > implementation-specific method is used to indicate end-of-line can   
   > only be portably identified as such by opening the file in text mode   
   > and looking for the newline characters that it gets converted into.   
   > But because of 7.23.2p2, text mode cannot be relied upon for   
   > precisely the files we're trying to identify.   
      
   Does not sound like a problem. According to my understanding, wide   
   portability was never a part of the OP's spec.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|