[Qt-interest] How to check between "Text" and "Non-Text"

Srdjan Todorovic todorovic.s at googlemail.com
Tue Apr 20 11:17:41 CEST 2010


On 20 April 2010 09:45, yogesh upreti <yogesh.upreti at gmail.com> wrote:

> @Wachter:
> Where can I find source for "file" command may be reading only header could
> be sufficient for me. I was looking something like this because with this I
> don't have to read the whole file through, because some binary files are
> huge (2-3 GB).

Interesting you should mention that - are any of the text files that large?
Perhaps you can add a file size check as part of your heuristics.

I suppose the other thing is that binary files would likely have a
uniform distribution of binary and ascii characters in the file - so
perhaps reading the first 3 MB of a file and marking it as a binary
file if any of that portion is a non-ascii data?

Srdjan



More information about the Qt-interest-old mailing list