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,394 of 243,242   
   Paul to tTh   
   Re: is_binary_file()   
   09 Dec 25 20:26:47   
   
   From: nospam@needed.invalid   
      
   On Tue, 12/9/2025 6:22 AM, tTh wrote:   
   > On 12/9/25 09:03, David Brown wrote:   
   >   
   >> But surely on Windows you can just look at the file extension - if it is   
   ".txt", it's a text file, otherwise it's a binary file.   
   >   
   >    And what about PNM files who can be pure ascii encoded,   
   >    but was image files ?   
   >   
      
   teapot.ppm    196,623 bytes   
      
   50 36 0A 32 35 36 20 32 35 36 0A 32 35 35 0A            # P6   
                                                           # 256 256   
                                                           # 255   
   13 5C C0   13 5C C0   13 5C C0   13 5C C0   13 5C C0    # binary byte tuples     
   0x13 0x5C 0xC0   
      
   ******************************************************************   
      
   teapot2.ppm   710,359 bytes   
      
   P3                                                        # P3 is the ASCII   
   format option   
   # Created by IrfanView                                    # (How you change   
   storage formats)   
   256 256   
   255   
   19 92 192  19 92 192   19 92 192   19 92 192   19 92 192  # Plain ASCII digits   
   (inefficient)   
      
   PNM supports both ASCII and binary payloads.   
   The magic value of P3 or P6 indicates the PPM payload types in the examples.   
      
   ********************************************************************   
      
   $ file *ppm   
   teapot.ppm:  Netpbm image data, size = 256 x 256, rawbits, pixmap   
   teapot2.ppm: Netpbm image data, size = 256 x 256, pixmap, ASCII text   
      
      Paul   
      
   --- 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