[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: Re: [PROGRAMMERING] [C] Læse fra proc fi



On Wed, 21 Jan 2004, Martin Schiotz wrote:

> Jeg tror, det er her jeg brug for et hint, min erfaring med c er
> ikke så stor. Jeg tænkte på at bruge select() udelukkende for at
> registrerer, når filen er blokeret / ikke blokeret (som du
> foreslår). Dvs. når der er ny data i /proc/test at læse.

Hvad laver dit program når der ikke er data fra /proc/test?
Skriver på skærmen hvert sekund, læser en anden fil,
læser input fra brugeren?

select() venter på at der sker noget med en fil, eller at der kommer 
en time-out.

Her er et eksempel
http://www.lowtek.com/sockets/select.html
som nok er lidt uoverskueligt i din sammenhæng.

> Men er der andre måder ?  (Hvad mente du med at blokere read())

Det er nok NON-BLOCKING, som er bedst at undgå. select er bedre.

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
If KNOPPIX can't do it, Linux can't do it.
					-- Binh Nguyen


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *