public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: simple c 's printf problem in mandrake8.0
       [not found] ` <3C2E4939.6070304@interaccess.com>
@ 2001-12-29 16:32   ` eric
  0 siblings, 0 replies; 8+ messages in thread
From: eric @ 2001-12-29 16:32 UTC (permalink / raw)
  To: Bryan W. Headley; +Cc: gcc-help

"Bryan W. Headley" wrote:
> 
> eric wrote:
> 
> > Dear gcc programmers:
> >
> >   I use the mandrake8.0, test a simple c program
> > printf("hello world"), it did not print anything, until I add \n at the
> > end of the string.
> 
> Has nothing to do with the compiler. As Andrew said, it's because
> there's no flush(). But that doesn't answer the question, really:
> somebody did a flush.
> 
> 1. Debian and Redhat patched glibc to do a flush on exit().
> 2. The shell you are using does a flush() on return from the program.
> 
> I'm voting for #2. Question is, do you use the same shell between
> Mandrake, Debian, Redhat? E.g., are they all bash?


in mandrake8.0, recommand install, it in /bin/bash , I get from env.
please tell me how to emansipate the restriction so that without switch
platform to redhat or debian, my printf("hello world") still can print
without \n at the end of string.  I also test its c++ code, same thing ,
if I did not add endl or "\n", it just not print.

bash  as 2.04 after I use rpm -q bash on my mdk8

sincere, eric, http://www.ezinfocenter.com/4436786
               http://www.onlineexchange.com/shilin




 If so, what version?
> Identical all across? Then we have to see if someone patched the shell...
> 
> If you have Redhat 7.2, they give you both gcc 2.96 and 3.02 (gcc and
> gcc3). The latter still is not completely stable -- it has problems
> building kde across all hardware platforms, for example. But it's
> getting better and is most stable on the i386, as that's where the
> majority of the user base is (as more testers = better code.)
> 
> Still, avoid people who give you stupid answers like "our compiler is
> better". Axes to grind, but no trees to chop down. They just swing the
> thing in air...
> 
> --
> ____               .:.                 ____
> Bryan W. Headley - bheadley@interaccess.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: simple c 's printf problem in mandrake8.0
  2001-12-31 13:28           ` eric
@ 2002-01-01  3:22             ` Stephano Mariani
  0 siblings, 0 replies; 8+ messages in thread
From: Stephano Mariani @ 2002-01-01  3:22 UTC (permalink / raw)
  To: 'eric'; +Cc: gcc-help

Perhaps it may be worth getting the CVS bash, and building that
yourself?
If not, see if you can find and older bash and use that (I use 2.04, you
presumably have 2.05a)...

Sorry I can't help you anymore! If it is not too much effort, you could
even get mandrake 8.1, the upgrade is simple.

Stephano

> -----Original Message-----
> From: root@mailnw.centurytel.net [mailto:root@mailnw.centurytel.net]
On
> Behalf Of eric
> Sent: 31 December 2001 13:36
> To: Stephano Mariani
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: simple c 's printf problem in mandrake8.0
> 
> Dear Stephano:
> 
>   both are not work on bash but work on csh on my mandrake 8.0, I also
> webmail them (mandrakesoft) on tech support, but they said it in not
in
> the scope they want to support.
> 
> 
> 
> Stephano Mariani wrote:
> >
> > Here is what I mean:
> >
> > #include <stdio.h>
> >
> > int main(int argc,char*const*argv)
> > {
> >   printf("Hello World"); /* No linefeed */
> >   fflush(stdout); /* Likewise for any other stream(s) you use */
> >   _exit(0);
> > }
> >
> > or even
> >
> > #include <stdio.h>
> >
> > int main(int argc,char*const*argv)
> > {
> >   if(setvbuf(stdout,NULL,_IONBF,(size_t)0)) /* Set buffering off */
> >   {
> >     /* Deal with error */
> >   }
> >   printf("Hello World"); /* No linefeed */
> >   _exit(0);
> > }
> >
> > Does that work... If not, get in touch with mandrakesoft on their
> > mailing lists.
> >
> > Stephano Mariani
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: simple c 's printf problem in mandrake8.0
  2001-12-30 11:27       ` eric
@ 2001-12-31 17:10         ` Stephano Mariani
  2001-12-31 13:28           ` eric
  0 siblings, 1 reply; 8+ messages in thread
From: Stephano Mariani @ 2001-12-31 17:10 UTC (permalink / raw)
  To: 'eric'; +Cc: gcc-help

Here is what I mean:

#include <stdio.h>

int main(int argc,char*const*argv)
{
  printf("Hello World"); /* No linefeed */
  fflush(stdout); /* Likewise for any other stream(s) you use */
  _exit(0);
}

or even

#include <stdio.h>

int main(int argc,char*const*argv)
{
  if(setvbuf(stdout,NULL,_IONBF,(size_t)0)) /* Set buffering off */
  {
    /* Deal with error */
  }
  printf("Hello World"); /* No linefeed */
  _exit(0);
}

Does that work... If not, get in touch with mandrakesoft on their
mailing lists.

Stephano Mariani

> -----Original Message-----
> From: root@mailnw.centurytel.net [mailto:root@mailnw.centurytel.net]
On
> Behalf Of eric
> Sent: 30 December 2001 12:31
> To: Stephano Mariani
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: simple c 's printf problem in mandrake8.0
> 
> Dear Stephano:
> 
>   I tried to put what you suggest fflush(stdout), either before or
after
> printf("hello World") , it still not print in bash shell.
> 
>   or I type fflush(stdout) in my bash command line, it response
command
> not found.
> 
>   Would you mind to explain a little bit more,
> > It's always a good idea to flush before you close a stream
> 
> on redhat 7.1 , it works(although whether it is bash or any other
> shell), so far as I know only mandrake8 is not work.
> 
> sincer eric, http://www.ezinfocenter.com/4436786
> 
> 
>   Stephano Mariani wrote:
> >
> > The cause is a bug in the libc on mandrake 8.x and redhat 7.x
> > In order to explicitly flush the buffer just use the fflush on the
> > stream you want to flush. E.g. fflush(stdout) in this case.
> >
> > It's always a good idea to flush before you close a stream.
> >
> > Stephano Mariani
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: simple c 's printf problem in mandrake8.0
  2001-12-31 17:10         ` Stephano Mariani
@ 2001-12-31 13:28           ` eric
  2002-01-01  3:22             ` Stephano Mariani
  0 siblings, 1 reply; 8+ messages in thread
From: eric @ 2001-12-31 13:28 UTC (permalink / raw)
  To: Stephano Mariani; +Cc: gcc-help

Dear Stephano:

  both are not work on bash but work on csh on my mandrake 8.0, I also
webmail them (mandrakesoft) on tech support, but they said it in not in
the scope they want to support.



Stephano Mariani wrote:
> 
> Here is what I mean:
> 
> #include <stdio.h>
> 
> int main(int argc,char*const*argv)
> {
>   printf("Hello World"); /* No linefeed */
>   fflush(stdout); /* Likewise for any other stream(s) you use */
>   _exit(0);
> }
> 
> or even
> 
> #include <stdio.h>
> 
> int main(int argc,char*const*argv)
> {
>   if(setvbuf(stdout,NULL,_IONBF,(size_t)0)) /* Set buffering off */
>   {
>     /* Deal with error */
>   }
>   printf("Hello World"); /* No linefeed */
>   _exit(0);
> }
> 
> Does that work... If not, get in touch with mandrakesoft on their
> mailing lists.
> 
> Stephano Mariani
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: simple c 's printf problem in mandrake8.0
  2001-12-30  1:47     ` Stephano Mariani
@ 2001-12-30 11:27       ` eric
  2001-12-31 17:10         ` Stephano Mariani
  0 siblings, 1 reply; 8+ messages in thread
From: eric @ 2001-12-30 11:27 UTC (permalink / raw)
  To: Stephano Mariani; +Cc: gcc-help

Dear Stephano:

  I tried to put what you suggest fflush(stdout), either before or after
printf("hello World") , it still not print in bash shell.

  or I type fflush(stdout) in my bash command line, it response command
not found.

  Would you mind to explain a little bit more, 
> It's always a good idea to flush before you close a stream

on redhat 7.1 , it works(although whether it is bash or any other
shell), so far as I know only mandrake8 is not work.

sincer eric, http://www.ezinfocenter.com/4436786
  
  
  Stephano Mariani wrote:
> 
> The cause is a bug in the libc on mandrake 8.x and redhat 7.x
> In order to explicitly flush the buffer just use the fflush on the
> stream you want to flush. E.g. fflush(stdout) in this case.
> 
> It's always a good idea to flush before you close a stream.
> 
> Stephano Mariani
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: simple c 's printf problem in mandrake8.0
  2001-12-29 21:35   ` Andrew Pinski
@ 2001-12-30  1:47     ` Stephano Mariani
  2001-12-30 11:27       ` eric
  0 siblings, 1 reply; 8+ messages in thread
From: Stephano Mariani @ 2001-12-30  1:47 UTC (permalink / raw)
  To: 'Andrew Pinski', 'eric'; +Cc: gcc-help

The cause is a bug in the libc on mandrake 8.x and redhat 7.x
In order to explicitly flush the buffer just use the fflush on the
stream you want to flush. E.g. fflush(stdout) in this case.

It's always a good idea to flush before you close a stream.

Stephano Mariani
 
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]
On
> Behalf Of Andrew Pinski
> Sent: 30 December 2001 05:33
> To: eric
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: simple c 's printf problem in mandrake8.0
> 
> I think bash and iff run by bash (not sh) will erase the line if there
> is no return.
> 
> Thanks,
> Andrew Pinski
> 
> PS this is getting off topic.
> On Saturday, December 29, 2001, at 05:32 , eric wrote:
> 
> > Dear Andrew:
> >
> >   I download and install gcc3.0.3 from gnu ftp site, by ./configure,
> > make, make install
> > they try my hello world in printf, it still not print out if no \n
at
> > the end.  Probably it is caused by shell(some told me)
> >
> >   I also tried to load libstdc++-v3.0.95 , but have difficult to
install
> > it
> > ./configure not work  for 3.0.3
> >   so I went to rpm find to get mdk's libstdc++ and isntall it.
> >
> > still not work,
> >
> >   I already report bug of glibc of gnu, (I am not sure it is a right
> > place or not).  But if you have more fresh idea to fix it please
email
> > me.
> >
> > sincere eric, http://www.ezinfocenter.com/4436786
> >
> >
> >
> >
> >
> >
> > Andrew Pinski wrote:
> >>
> >> It is not because of the compiler but because of the libc library
> >> does not flush at the end of the program which I consider a bug.
> >> But this is OT for this list.
> >>
> >> Thanks,
> >> Andrew Pinski
> >>
> >> PS MDK8.0 and RedHat7.1's compilers are junk update them to at
least
> >> 3.0
> >>
> >> On Saturday, December 29, 2001, at 09:48 , eric wrote:
> >>
> >>> Dear gcc programmers:
> >>>
> >>>   I use the mandrake8.0, test a simple c program
> >>> printf("hello world"), it did not print anything, until I add \n
at
> >>> the
> >>> end of the string.
> >>> such result never happen in redhat7.1 or debian-progeny1.0.  some
of
> >>> mdk's newbie tell me it is because "our compiler is more stricter
than
> >>> theirs", I wonder whether it is true, especially the program
written
> >>> and
> >>> compiled by the way of redaht or debian may cause error or any
> >>> unpredicted result run on mandrke.
> >>>
> >>>   are any file I should install so it can print the "hello world"
> >>> without \n?
> >>>
> >>> highly appreciate your tech help
> >>> sincere eric
> >>> http://www.onlineexchange.com/shilin
> >>>
> >>>
> >
> >



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: simple c 's printf problem in mandrake8.0
  2001-12-29 21:29 ` eric
@ 2001-12-29 21:35   ` Andrew Pinski
  2001-12-30  1:47     ` Stephano Mariani
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Pinski @ 2001-12-29 21:35 UTC (permalink / raw)
  To: eric; +Cc: gcc-help

I think bash and iff run by bash (not sh) will erase the line if there 
is no return.

Thanks,
Andrew Pinski

PS this is getting off topic.
On Saturday, December 29, 2001, at 05:32 , eric wrote:

> Dear Andrew:
>
>   I download and install gcc3.0.3 from gnu ftp site, by ./configure,
> make, make install
> they try my hello world in printf, it still not print out if no \n at
> the end.  Probably it is caused by shell(some told me)
>
>   I also tried to load libstdc++-v3.0.95 , but have difficult to install
> it
> ./configure not work  for 3.0.3
>   so I went to rpm find to get mdk's libstdc++ and isntall it.
>
> still not work,
>
>   I already report bug of glibc of gnu, (I am not sure it is a right
> place or not).  But if you have more fresh idea to fix it please email
> me.
>
> sincere eric, http://www.ezinfocenter.com/4436786
>
>
>
>
>
>
> Andrew Pinski wrote:
>>
>> It is not because of the compiler but because of the libc library
>> does not flush at the end of the program which I consider a bug.
>> But this is OT for this list.
>>
>> Thanks,
>> Andrew Pinski
>>
>> PS MDK8.0 and RedHat7.1's compilers are junk update them to at least 
>> 3.0
>>
>> On Saturday, December 29, 2001, at 09:48 , eric wrote:
>>
>>> Dear gcc programmers:
>>>
>>>   I use the mandrake8.0, test a simple c program
>>> printf("hello world"), it did not print anything, until I add \n at 
>>> the
>>> end of the string.
>>> such result never happen in redhat7.1 or debian-progeny1.0.  some of
>>> mdk's newbie tell me it is because "our compiler is more stricter than
>>> theirs", I wonder whether it is true, especially the program written 
>>> and
>>> compiled by the way of redaht or debian may cause error or any
>>> unpredicted result run on mandrke.
>>>
>>>   are any file I should install so it can print the "hello world"
>>> without \n?
>>>
>>> highly appreciate your tech help
>>> sincere eric
>>> http://www.onlineexchange.com/shilin
>>>
>>>
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: simple c 's printf problem in mandrake8.0
       [not found] <54F80F22-FCA6-11D5-93F0-000393122612@physics.uc.edu>
@ 2001-12-29 21:29 ` eric
  2001-12-29 21:35   ` Andrew Pinski
  0 siblings, 1 reply; 8+ messages in thread
From: eric @ 2001-12-29 21:29 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-help

Dear Andrew:

  I download and install gcc3.0.3 from gnu ftp site, by ./configure,
make, make install
they try my hello world in printf, it still not print out if no \n at
the end.  Probably it is caused by shell(some told me)

  I also tried to load libstdc++-v3.0.95 , but have difficult to install
it
./configure not work  for 3.0.3
  so I went to rpm find to get mdk's libstdc++ and isntall it.

still not work,  

  I already report bug of glibc of gnu, (I am not sure it is a right
place or not).  But if you have more fresh idea to fix it please email
me.

sincere eric, http://www.ezinfocenter.com/4436786






Andrew Pinski wrote:
> 
> It is not because of the compiler but because of the libc library
> does not flush at the end of the program which I consider a bug.
> But this is OT for this list.
> 
> Thanks,
> Andrew Pinski
> 
> PS MDK8.0 and RedHat7.1's compilers are junk update them to at least 3.0
> 
> On Saturday, December 29, 2001, at 09:48 , eric wrote:
> 
> > Dear gcc programmers:
> >
> >   I use the mandrake8.0, test a simple c program
> > printf("hello world"), it did not print anything, until I add \n at the
> > end of the string.
> > such result never happen in redhat7.1 or debian-progeny1.0.  some of
> > mdk's newbie tell me it is because "our compiler is more stricter than
> > theirs", I wonder whether it is true, especially the program written and
> > compiled by the way of redaht or debian may cause error or any
> > unpredicted result run on mandrke.
> >
> >   are any file I should install so it can print the "hello world"
> > without \n?
> >
> > highly appreciate your tech help
> > sincere eric
> > http://www.onlineexchange.com/shilin
> >
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-01-01 11:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3C2DD7CC.E7C8FAA8@centurytel.net>
     [not found] ` <3C2E4939.6070304@interaccess.com>
2001-12-29 16:32   ` simple c 's printf problem in mandrake8.0 eric
     [not found] <54F80F22-FCA6-11D5-93F0-000393122612@physics.uc.edu>
2001-12-29 21:29 ` eric
2001-12-29 21:35   ` Andrew Pinski
2001-12-30  1:47     ` Stephano Mariani
2001-12-30 11:27       ` eric
2001-12-31 17:10         ` Stephano Mariani
2001-12-31 13:28           ` eric
2002-01-01  3:22             ` Stephano Mariani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).