int main(void){
fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
if (fd > 0) {
ioctl(fd, CDROMCLOSETRAY, 0);
close(fd);
}
}
Je sauve et je quitte -> :wq
Je tape :
cc /home/force_close.c -o /home/force_close
et voila ce que mon pc me dit:
/home/force_close.c: Dans la fonction « main »:
/home/force_close.c:8: error: `fd' undeclared (first use in this function)
/home/force_close.c:8: error: (Each undeclared identifier is reported only once
/home/force_close.c:8: error: for each function it appears in.)
[^] # Oups, help !!! (ö)
Posté par julien pooloots . En réponse au message Programme qui referme mon lecteur CD. Évalué à 1.
donc voila ce que j'ai fait :
vi /home/force_close.c
#include <sys/ioctl.h>
#include <linux/cdrom.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(void){
fd = open("/dev/cdrom", O_RDONLY|O_NONBLOCK, 0);
if (fd > 0) {
ioctl(fd, CDROMCLOSETRAY, 0);
close(fd);
}
}
Je sauve et je quitte -> :wq
Je tape :
cc /home/force_close.c -o /home/force_close
et voila ce que mon pc me dit:
/home/force_close.c: Dans la fonction « main »:
/home/force_close.c:8: error: `fd' undeclared (first use in this function)
/home/force_close.c:8: error: (Each undeclared identifier is reported only once
/home/force_close.c:8: error: for each function it appears in.)
Que dois-je faire svp
Merci