[so] Probleme de scriere la stderr pe windows

Lucian Adrian Grijincu lucian.grijincu at gmail.com
Mon Apr 7 17:18:20 EEST 2008


> Maximilian Machedon <maximilian.machedon at gmail.com> wrote:
>  Ma rog.. se face flush cand se termina programul (normal), deci probabil nu
> e de la asta. :-P

2008/4/7 Tiugan Radu <tiuganradu at yahoo.com>:
> Asa m-am gandit si eu ca la terminarea programului se face flush. Dar chit
> ca am pus \n nu se facea. Am rezolvat cu un fflush.

How do you like them apples?

Standardul C spune ca la exit(3) trebuie să se inchida/flush-uiasca
streamurile deschise:
<q>
     Before termination it performs the following functions in the order
     listed:
	   1.	Call the functions registered with the atexit(3) function, in
		the reverse order of their registration.
	   2.	Flush all open output streams.
	   3.	Close all open streams.
	   4.	Unlink all files created with the tmpfile(3) function.
    ...
     The exit() function conforms to ISO/IEC 9899:1990 (``ISO C89'').
</q>


Altundeva spune că un program care se termină cu "return value;" din
main() e echivalent cu unul care dă exit(value).

Nu sunt sigur, dar cred ca FILE* sunt acele "streams" de care pomenește C89.

din man 3 exit:
<q>
       All open stdio(3) streams are flushed and  closed.   Files  created  by
       tmpfile(3) are removed.
</q>

Mă înșel?
Dacă da, atunci faptul că nu se face fflush automat ar trebui
considerat un bug al [g]libc?

--
Lucian


More information about the so mailing list