Skip to content
Advertisement

How to eject the CD Drive on Linux using C?

I was reading through this Advanced Linux Programming tutorial when I encountered a problem. I was trying to eject the CD-ROM drive using this code:

JavaScript

Then I try to compile this code and get the following output:

JavaScript

So what am I doing wrong?

Advertisement

Answer

The error message you’re seeing looks like something is wrong in your #include lines, not with the code you posted. I tried compiling http://www.advancedlinuxprogramming.com/listings/chapter-6/cdrom-eject.c and it compiles just fine.

Advertisement