$ ptpython
In [1]: from ctypes import CDLL
In [2]: libc = CDLL('libc.so.6')
In [3]: libc.printf(b"hello")
5
In [4]: # press <C-D> to exit
hello
For python
$ python
Python 3.10.12 (main, Jun 6 2023, 22:43:10) [GCC 12.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import CDLL
>>> libc = CDLL('libc.so.6')
>>> libc.printf(b'hello')
5
hello>>>
Why they are different? How to make them same? TIA!
ptpython only output when it exit:
For python
Why they are different? How to make them same? TIA!