> and I'm calling it here:
>
> len = ioctl(cd, 0);
> perror("ioctl");
>
> but when runnig it says:
>
> ioctl: Inappropriate ioctl for device
>
> where's the problem?
You should only call perror if ioctl returned -1.
Try:
len = ioctl(cd, 0);
if (len == -1)
{
perror("ioctl");
}