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]

Reply via email to