🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16609

Re: Ascii or binary file

#16609
From: JOHNNY LIWIS
Date: Fri, 09 May 2003 09:59
32 lines
1968 bytes
Not so practical, especially when you have big files, anyway thank you
everybody!

"Andrue Cope" <not.a.valid@email.address.sorry> skrev i meddelandet
news:VA.00001c9d.01332329@email.address.sorry...
> Johnny Liwis,
>
> > How do I know if the file has binary or ascii content ?
> >
>
> All you can do is scan the entire files and determine if all the byte
> values lie within the acceptable range for 'ascii content' whatever
> that is.
>
> FWIW we have a routine that does a pretty good job at this kind of
> thing. We use it to decide whether to activate a hex view or text
> view. The decision is based upon the following function:
>
> bool TOTextLineIndexer::IsMainlyTextual()
> {
>   return !( ( MyFileSize-MyViewableText )>( 3*MyViewableText ) );
> }
>
> Where MyViewableText is the count of bytes whose values lie within
> the range 32 (space) to 0x7F.
>
> I can't give particular statistics for success but we use it a lot
> and it chooses the right mode most of the time.
>
> Andrue Cope
> [Bicester, UK]
>
Technical Details
Message-ID: <3ebb7c02$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3eba4f4a@newsgroups.borland.com> <VA.00001c9d.01332329@email.address.sorry>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,65ce5fe967ca5eb
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-09 03:03:23 PST
From: "JOHNNY LIWIS" <jone@chello.se>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3eba4f4a@newsgroups.borland.com> <VA.00001c9d.01332329@email.address.sorry>
Subject: Re: Ascii or binary file
Date: Fri, 9 May 2003 11:59:29 +0200
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 213.89.40.24
Message-ID: <3ebb7c02$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052474370 213.89.40.24 (9 May 2003 02:59:30 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail