All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rechberger Markus <mrechberger@gmail.com>
To: michael young <mhyoung@valdosta.edu>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: ioctl.h
Date: Fri, 4 Mar 2005 22:55:41 +0100	[thread overview]
Message-ID: <d9def9db0503041355660768a0@mail.gmail.com> (raw)
In-Reply-To: <4228B3B8.7020507@valdosta.edu>

hey Michael,

here just an example:

this small tool opens the cd tray

#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <linux/cdrom.h>

int main(){
    int cdrom;
    if ((cdrom = open("/dev/cdrom",O_RDONLY | O_NONBLOCK)) < 0) {
            perror("open");
            exit(1);
    }
    if (ioctl(cdrom,CDROMEJECT,0)<0) {
            perror("ioctl");
            exit(1);
    }
    close(cdrom);
    return(0);
}

simply build it with gcc tray.c -o tray

look at cdrom.h for more defined operations, you will also find
CDROMEJECT in there, 0 is an argument see the manpage (man ioctl) for
more infos..

Markus

On Fri, 04 Mar 2005 14:15:04 -0500, michael young <mhyoung@valdosta.edu> wrote:
> Hi,
> how do you use the ioctl.h?
> there seems to be little info on it
> on the web or in print. If you know
> of anything on the web please let me
> know.
> 
> thank you,
> Mike
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  parent reply	other threads:[~2005-03-04 21:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-04 19:15 ioctl.h michael young
2005-03-04 20:54 ` ioctl.h J.
2005-03-04 21:55 ` Rechberger Markus [this message]
2005-03-07 14:45   ` ioctl.h michael young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9def9db0503041355660768a0@mail.gmail.com \
    --to=mrechberger@gmail.com \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=mhyoung@valdosta.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.