🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Ascii or binary file

#16482
From: Michael Kelly
Date: Sat, 10 May 2003 00:00
22 lines
1868 bytes
On Fri, 09 May 2003 12:44:16 -0400, Jim Dodd <bcbuilderboy@yahoo.com> wrote:

>Actually, I employ my own "factor" which I was reminded of when reading 
>Gambit's later reply - I don't usually read the entire file. I pick a 
>percentage of the file size and read that (usually 10-20%) and if I 
>haven't found any non-text characters by that time, I declare it text.

Or you could take a look for the source to the Linux
"file" command.  It does a pretty good job of guessing
the type of file, such as executable, data file, text,
jpeg picture file, script etc..

You might have to make a few adjustments for Windows
(or there may be a port of it already on sourceforge or
CygWin or one of the other sites.)


-- 

"I don't want to belong to any club that would have me as a member."

    -- Groucho Marx
Technical Details
Message-ID: <29gobv43votb7vtfej0c4na0tkoerih9ah@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!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> <3eba6b37$1@newsgroups.borland.com> <VA.00001c9e.01a5e272@email.address.sorry> <3ebbdade$1@newsgroups.borland.com>

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 17:17:38 PST
From: Michael Kelly <mkelly2002@adelphia.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Ascii or binary file
Date: Fri, 09 May 2003 20:00:45 -0400
Message-ID: <29gobv43votb7vtfej0c4na0tkoerih9ah@4ax.com>
References: <3eba4f4a@newsgroups.borland.com> <VA.00001c9d.01332329@email.address.sorry> <3eba6b37$1@newsgroups.borland.com> <VA.00001c9e.01a5e272@email.address.sorry> <3ebbdade$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.92/32.572
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 24.51.218.66
X-Trace: newsgroups.borland.com 1052524847 24.51.218.66 (9 May 2003 17:00:47 -0700)
Lines: 22
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail