.dsy:it.
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Tech (http://www.dsy.it/forum/forumdisplay.php?forumid=189)
-- [Linux] fopen() fallisce (http://www.dsy.it/forum/showthread.php?threadid=22556)


Posted by Hamelin on 08-11-2005 09:41:

[Linux] fopen() fallisce

Scrivendo un piccolissimo programma in C, desideravo leggere informazioni sulla batteria da un file (in /proc/acpi): la fopen () fallisce... il problema sta nel fatto che il file è utilizzato da un altro programma (non è possibile aprirne una copia in sola lettura?)? oppure c'è qualche problema di permessi (non credo, perché ho tutti i permessi di lettura necessari... e non funza nemmeno da root)?

In sintesi. Come faccio a leggere un file nella directory /proc con un programma C o C++?!?

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."


Posted by Walter on 08-11-2005 10:18:

Originally posted by Hamelin
In sintesi. Come faccio a leggere un file nella directory /proc con un programma C o C++?!?

Qui c'è un articolo a riguardo.
Di che file si tratta?
Che valore assume la variabile globale errno dopo il fallimento di fopen?

__________________
"Ragione e passione sono timone e vela della nostra anima navigante." - Kahlil Gibran
"Senza musica la vita sarebbe un errore." - Friedrich Nietzsche


Posted by Hamelin on 08-11-2005 19:43:

Grazie mille! Penso mi possa risolvere il problema...

__________________
Bjarne Stroustrup: "I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone."
Andrew S. Tanenbaum: "Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway."
Edsger Dijkstra: "Computer Science is no more about computers than astronomy is about telescopes."
Robert Firth: "One of the main causes of the fall of the Roman Empire was that, lacking zero, they had no way to indicate successful termination of their C programs."
Donald Knuth: "A mathematical formula should never be 'owned' by anybody! Mathematics belong to God."


Posted by Walter on 08-11-2005 19:46:

Tienici aggiornati! :D

__________________
"Ragione e passione sono timone e vela della nostra anima navigante." - Kahlil Gibran
"Senza musica la vita sarebbe un errore." - Friedrich Nietzsche


All times are GMT. The time now is 18:39.
Show all 4 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.