binary vs. text?

Sarah Reichelt sarah.reichelt at gmail.com
Mon Dec 11 16:14:31 CST 2006


On 12/12/06, Chris Sheffield <cmsheffield at gmail.com> wrote:
> Does anyone have a sure fire way to determine if a file is binary or
> text?
>
> I have need to create an import utility that will import data from a
> text file (csv, tab-delimited, etc) into a database, but I'd like to
> check the file before doing anything else just to make sure it is in
> fact text and not binary.


Just a guess here but how about reading the file twice: once as file:
and once as binfile:
If the two are identical, then I assume it's text only.

I have no idea if this will work, but it's worth a try :-)
Sarah



More information about the use-livecode mailing list