[fpc-pascal] CDROM handling question

Henry Vermaak henry.vermaak at gmail.com
Tue Nov 21 14:54:39 CET 2006

On Tue, 21 Nov 2006, Pianoman wrote:
> Hello, I 'd like to ask how can I detect whether a CDROM drive is ejected. I
> have program which reads some data from CD after reading this data I eject the
> cd using some calls and user can replace the disk. How can I automatically
> close CD drive let's say after pressing enter?

Hello, if you're in linux you can get tray position with a
CDROM_DRIVE_STATUS ioctl call.  There is a CDROMCLOSETRAY ioctl
defined, but it didn't work for me (as far as I remember).

Take a look at kernel docs for ioctl and cdrom.h.


More information about the fpc-pascal mailing list