X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: "jansb000" Newsgroups: comp.os.msdos.djgpp Subject: Re: how to determine if a file is text/binary Date: Wed, 1 May 2002 21:45:36 +0200 Organization: Planet Internet Lines: 23 Message-ID: References: NNTP-Posting-Host: ipc3797b4e.dial.wxs.nl X-Trace: reader05.wxs.nl 1020282335 19137 195.121.123.78 (1 May 2002 19:45:35 GMT) X-Complaints-To: abuse AT planet DOT nl NNTP-Posting-Date: 1 May 2002 19:45:35 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com If all data that you read is between Hex 20 and Hex 7F (with exception for Hex 0D or Hex 0D 0A) then there is a good chance the file is ASCII. To be more sure: Test if you can detect sentences in the form: ASCII_FILE = ASCII_SEQUENCE + TERMINATOR ASCII_SEQUENCE = ASCII2_SEQUENCE + LINE_BREAK ASCII2_SEQUENCE = ASCII* [+ SPACE* + ASCII*]* ASCII = 'A', 'B', 'C', etc ... SPACE = ' ', '\t', etc ... "xeon" schreef in bericht news:c21a43ff DOT 0204302309 DOT 7c13ed96 AT posting DOT google DOT com... > Eli Zaretskii wrote in message news:... > > The usual technique is to read a portion of a file, say, 16KB, and see if > > it contains null characters (`\0'). > Is there any other way? Test reading Kb's of data may not be an option > in this particular project. > > TIA