This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Strange behavior of MSVC's printf under cygwin shell?


Hi,

Why does the screen output displayed using MSVC's printf subroutine not get
shown immediately under Cygwin shell (bash, specifically)? Rather, it would
wait for a long time before showing the text lines (many lines at once). How
to change this behavior?

I used the following (simple) code as an example:

#include<stdio.h>
int main() {
    for (int i=0; i < 50; ++i) {
        printf("%d %d\n", i, i*i);
        for (int j=0; j < 10000000; ++j); /* just for delay */
    }
    return 0;
}

Try to compile it using: gcc -mno-cygwin sample.c , then run it: ./a.exe. If
you remove "-mno-cygwin", this strange behavior disappears. Under MS-DOS
shell, this behavior does not exist.

Thanks,
Wirawan

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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