Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!bbn.com!mips2!rws1!mwarren From: mwarren@rws1.ma30.bull.com (Mark Warren) Newsgroups: comp.unix.programmer Subject: Re: Unix binary/text files: is there a difference? Message-ID: Date: 20 Mar 91 20:50:11 GMT References: <77384@bu.edu.bu.edu> Sender: @mips2.cr.bull.com Distribution: usa Organization: Bull HN Informations Systems Inc. Lines: 21 jdubb@bucsf.bu.edu (jay dubb) writes: > I've looked in a bunch of C and Unix books, and can't seem to find >a good explanation of this - maybe someone can help... Is there a way >to tell (from a C program) whether a given file contains text or data? There is no difference in Unix. Other operating systems have some flags associated with files that indicate contents, format, etc., but Unix treats all files as uninterpreted byte streams. Unix supplies a "file" utility that tries (usually successfully) to guess what the file is, but it is nothing more than a guess that applies some heuristics to the first few bytes read from the file. Sorry, there's no guaranteed way to do it. -- == Mark Warren Bull HN Information Systems Inc. == == (508) 294-3171 (FAX 294-3020) 300 Concord Road MS852A == == Mark.Warren@bull.com Billerica, MA 01821 ==