Mail Archives: djgpp/1995/08/10/06:14:10
On Wed, 9 Aug 1995, Dr. Norman Fahrer wrote:
> I use the DOS ported awk and want to make sure
> that the file it works on is NOT a binary but
> a TEXT file, so not to run into the 'out of memory'
> problem that occures when the record which is read
> in is the entire file.
>
> What would be a good way to prevent that the awk
> is fed with a NOT-text file (under DOS) ?
Your best bet is to write a small program which reads the first, say 4KB
of the file, then for non-text characters in that block. If it finds
them, let it return a non-zero status to DOS, which you can test for
either in a batch file or from inside Awk.
- Raw text -