[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: Sv: [CPROG] Position af cursor i textmode UDEN brug af ncurses



"Søren Lambæk" <sslug@sslug> writes:

> Jeg har for nyligt undret mig over hvorfor der flushes i noget andet sw som
> jeg har kigget på.
> 
> Kan du give en kort forklaring på hvorfor man skal/skal ikke gøre dette.
> 
> I min C bibel stod der bare noget om at det kun bruges i specielle tilfælde

Se fx. man stdio -- og for UNIX programmet generalt, læs W. Richard
Stevens' "Advanced Programming in the UNIX Environment".

Per default når du starter op er standard output "line buffered",
altså der kommer ikke noget ud indtil du skriver et \n. Standard error
er unbuffered. Det er simpelthen af effektivitetshensyn (ikke så
vigtig nu som dengang for 10 år siden).

Dog hvis programmets standard output ikke er forbundet til en TTY
(altså du redirecter til en fil, altså kører ditProgram > enFil) så
bliver standard output blok-bufferet (altså der bliver først flushet
efter 4k).

Disse buffere gemmes i programmets eget hukommelsesområde. Når
bufferen bliver fyldt udføres der et systemkald (write). Det er
forholdsvis dyrt at skifte til kernen i forhold til at bare blive ved
med at udføre programmet i userspace.
 

-- 
===============================================================
<sslug@sslug>     Herlev, Denmark     Software Designer
<URL:http://www.andreasen.org/>   <*>   Eicon Networks Research
===============================================================



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 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] *