Roy
Roy

Reputation: 867

How do I check whether a file I'm opening is a block device or charachter device?

Is there a function in c that checks whether a file is a block device or charachter device?

Thanks!

Upvotes: 0

Views: 2540

Answers (1)

sandymatt
sandymatt

Reputation: 5612

You're probably looking for lstat, if you're under linux:

http://linux.die.net/man/2/lstat

You should have access to the macros S_ISCHR and S_ISBLK.

Upvotes: 2

Related Questions