i would like to know that from where did u get this information from,can u share that..
On Thu, Nov 4, 2010 at 2:10 AM, Faisal Fiza <[email protected]>wrote: > > stdout is buffered, display the content in the buffer only after it meets a > new line character. > we can use fprintf() or write() system call to print immediately. > > another option is u can unbuffer the stdout stream using a function call : > setbuf(stdout,NULL); > after calling above function, immediately display the content when u call > printf, without waiting for a \n char. > > > > Can somebody please explain the reason why we had to use fflush? > > > On Thu, Nov 4, 2010 at 11:21 AM, Praseed Pai <[email protected]> wrote: > >> Hi shibin , >> Great ! >> >> regards >> Praseed Pai >> >> >> --- On *Thu, 11/4/10, shibin k reeny <[email protected]>* wrote: >> >> >> From: shibin k reeny <[email protected]> >> Subject: Re: [ILUG-Cochin.org] Indefinite loop in C >> To: "This List discusses GNU/Linux & GNU, GPL Software" < >> [email protected]> >> Date: Thursday, November 4, 2010, 12:12 AM >> >> >> try this code.. >> #include<stdio.h> >> main() >> { >> >> printf("Hello World"); >> fflush(stdout); >> while(1); >> >> } >> >> >> but i dont know why we have to use fflush(stdout); function or why other >> code didnt work. >> On Wed, Nov 3, 2010 at 1:28 PM, Antony Padayattil >> <[email protected]<http://mc/[email protected]> >> > wrote: >> >> I expected the following code to print "Hello World" and then enter an >> indefinite loop. But, contrary to what I expected, it seems that it directly >> enters the loop. >> >> >> Here is the code: >> >> #include<stdio.h> >> >> main() >> >> { >> >> printf("Hello World"); >> >> while(1) >> >> ; >> >> } >> >> >> I have also noted that if "Hello\nWorld" is given instead of "Hello >> World", it prints "Hello" and then enters the loop. >> >> Requesting explanation. >> Thanks in advance. >> >> >> >> _______________________________________________ >> Indian Libre User Group Cochin Mailing List >> http://www.ilug-cochin.org/mailing-list/ >> http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org >> #[email protected]<http://mc/[email protected]> >> >> >> >> -----Inline Attachment Follows----- >> >> >> _______________________________________________ >> Indian Libre User Group Cochin Mailing List >> http://www.ilug-cochin.org/mailing-list/ >> http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org >> #[email protected]<http://mc/[email protected]> >> >> >> >> _______________________________________________ >> Indian Libre User Group Cochin Mailing List >> http://www.ilug-cochin.org/mailing-list/ >> http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org >> #[email protected] >> > > > > -- > Dibu John Philip > > http://djnetworkz.com > @dibujphilip <http://www.twitter.com/dibujphilip> > > > > _______________________________________________ > Indian Libre User Group Cochin Mailing List > http://www.ilug-cochin.org/mailing-list/ > http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org > #[email protected] >
_______________________________________________ Indian Libre User Group Cochin Mailing List http://www.ilug-cochin.org/mailing-list/ http://mail.ilug-cochin.org/mailman/listinfo/mailinglist_ilug-cochin.org #[email protected]
