why msvcrt.printf show the first char only?

Nobody nobody at nowhere.com
Wed Oct 12 07:50:34 EDT 2011


On Wed, 12 Oct 2011 04:18:25 -0700, installman at 189.cn wrote:

> from ctypes import *
> msvcrt = cdll.msvcrt
> message_string = "Hello world!\n"
> print(msvcrt.printf("Testing: %s", message_string))
> 
> when running in eclipse, the result is:
> 1
> T
> 
> when running in IDLE, then result is:
> 1
> 
> why is that?

Odd. I get 22 when running from IDLE.

Also, when using the console, it actually prints the text. I suspect that
stdout gets block-buffered when using an IDE. I can't see any way to get a
reference to stdout, so you can't fflush() it.




More information about the Python-list mailing list