[comp.sys.amiga.tech] Text files

paolucci@snll-arpagw.UUCP (Sam Paolucci) (06/03/88)

Does anybody know of an algorithm for detecting weather a file is a
text file or not short of reading the the entire file.

					-+= SAM =+-

"the best things in life are free"

				ARPA: paolucci@snll-arpagw.llnl.gov

doug-merritt@cup.portal.com (06/05/88)

Sam asks:
>Does anybody know of an algorithm for detecting weather a file is a
>text file or not short of reading the the entire file.

The obvious answer is: see whether the first 512 bytes contain anything
other than ascii graphics (space thru tilde) and whitespace (cr, nl,
backspace, control-L).

If you don't want to read the whole file, don't read the whole file.
Am I misunderstanding your question???

If what you're asking is "does AmigaDOS keep track of file type, so
you could do some magic call and find out that it's a text file for
certain", then the answer is "no".

Unfortunately for those of us who are object-oriented. Or fortunately,
from the point of view of those who hate dealing with Macintosh resource
forks.
	Doug
--
      Doug Merritt        ucbvax!sun.com!cup.portal.com!doug-merritt
                      or  ucbvax!eris!doug (doug@eris.berkeley.edu)
                      or  ucbvax!unisoft!certes!doug