PDA

View Full Version : [C] lettura da stdin


Duchamp
23-04-2010, 16:05
Buon pomeriggio.
Vorrei leggere una grossa quantità di dati provenienti da stdin, utilizzando fgets (oppure fgetc). Fin qui non ci sono problemi, però mi piacerebbe creare una specie di barra di progesso che mi dica a che punto è arrivata la lettura.
Teoricamente un'idea ce l'ho: uso fgets/fgetc impostando un numero fisso di dati da leggere (es. 1024), ripetendo l'operazione fino a che la lettura non termina (dati da leggere == dati letti). Nella pratica però non saprei come muovermi: è davvero possibile leggere "a pezzi" ciò che arriva in input dall'esterno?
Ringrazio e saluto

cionci
23-04-2010, 17:07
Certo che è possibile, basta fare un ciclo...

Hardware Upgrade Forum Database Error
Database Error Database error
The Hardware Upgrade Forum database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.hwupgrade.it home page, then try to open another page.
  • Click the Back button to try another link.
The www.hwupgrade.it forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.