ioctl to set mixer volume

Alain De Vos devosalain at ymail.com
Sat Apr 17 00:05:41 UTC 2021


After some fiddling i finally got it.
A d-lang program which sets my volume to zero.
```
import std.stdio;
import core.sys.posix.ioctl;
import core.stdc.config;
import core.stdc.stdio;
void main() {
writeln("Set vol to min");
char *mixerdev=cast(char *)"/dev/mixer";
char *mode=cast(char *)"rw";
int mixfd=(fopen(mixerdev,mode)).fileno;
writeln(mixfd);
c_ulong x=3221507328;
int left=0;
ioctl(mixfd,x, &left);
}
```
The function .fileno returns the "underlying handle" of the FILE 
"object".


More information about the Digitalmars-d-learn mailing list