[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: (no subject)
On Mon, Jun 05, 2000 at 06:08:40PM +0530, Satheesh Kumar. N.K wrote:
> How can I make out if a file is binary or text given its path?
> Is there a system call which will help me through this? Note that
> I don't want to test if a file is block special, char special etc. All I
> want is if a given file is binary or text.
You need to open the file, read the first few bytes and see if you can
figure out the type of the file. Basically, see if you can rip off the
logic of the "file" command in a library.
Also, people reading this list should also read the UNIX programmer's faq