I coded this little Script while reading „Hacking with Python“ from Justin Seitz. I got the following error:
from ctypes import *
msvcrt = cdll.msvcrt
message_string = b"Hallo, Welt \n"
msvcrt.printf(b"Test: %s", message_string)
Output in IDLE3 interactivly:
19
or IDLE3 directly:
====================== Restart: C:\Users\TN\Desktop\ctayps.py ======================
Answer:
printf writes the output not to the sys.stdout in Python like normal, it writes the output to the operating system std.out. So You have to start your script in the cmd directly.
Justin Seitz: Hacking with Python
[Python3|ctypes] printf() doesnt print on screen or it counts | IDLE IDLE3 PythonWin