trouble with open()

From: <hidden>
Date: 1999-10-03 16:24:54

Ok, maybe I'm just being really stupid, but the following code isn't
working for me.

I'm trying to open /dev/dsp. The file descriptor returned by open is 0,
which is supposed to be stdin, right? Anyways, a subsequent call to
ioctl doesn't like fd 0 either.

[dev->path = "/dev/dsp"]

    printf("attmpting to open %s\n", dev->path);
    if (dev->dev_fd = open(dev->path, O_RDWR) < 0) {
        perror(dev->path);
        fprintf(stderr, "Couldn't open audio device %s!\n", dev->path);
        return -1;
    }
    printf("dev_fd = %i\n", dev->dev_fd);

When I run this code, my output is:
attempting to open /dev/dsp
dev_fd = 0

The permissions are set fine, and I get the same problem with
/dev/audio.

What am I doing wrong? I ask because I'm a little frustrated at this
point.

-Hollis

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help