3 ms·
FILE *fh = fopen("/dev/cd/do", "w"); fputs("eject\n", fh); AFAIU, people use ioctl because it's a more strongly typed interface compared to juggling strings
by wahern 10y ago
FILE *fh = fopen("/dev/cd/do", "w");
fputs("eject\n", fh);
AFAIU, people use ioctl because it's a more strongly typed interface compared to juggling strings (usually the implementation defines the interface via /usr/include headers, useful from C), and because historically implementing an ioctl interface for a new device was easier in kernel implementations, including early Linux (and arguably still).