This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fflush not working on egcs-2.91.66 (linux kernel 2.2.5-15)



Hi folks,
 This is a very simple program going hay wire.
 fflush does not flush!
 The same program works perfectly
 in - GCC on a Sun Solaris
    - MSVC++ 6.0 (DOS mode)

 Any help is greatly appreciated.
Thanks,
 - Anand Vadul
ps:
 Hardware : redhat-linux 6.0 
  Standard kernel 2.2.5-15
 GCC : Built in : egcs-2.91.66 19990314/Linux(egcs-1.1.2 release)
------------------------ begin ---------------
 #include <stdio.h> 
 int main()
 {
  char c;
  fflush(stdin);
  for(;;) {
   printf("Enter C:");
   c=getchar();
   fflush(stdin);
   printf("C got is :%c\n",c);
  }
  return 0;
 }
------------------------ end -----------------
Inputs :
    h
    he
    hel
    help

Expected result :     Actual Result
 Enter C :h           Enter C :h
 C got is :h          C got is :hEnter C :
 Enter C :he          C got is :Enter C :he
 C got is :h          C got is :hEnter C:
 Enter C :hel         C got is :eEnter C:
 C got is :h          C got is :

 ........
    



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]