ansiterm.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:SoCFoundationFlow 作者: mattaw 项目源码 文件源码
def writeconsole(self, txt):
            chars_written = c_ulong()
            writeconsole = windll.kernel32.WriteConsoleA
            if isinstance(txt, _type):
                writeconsole = windll.kernel32.WriteConsoleW

            # MSDN says that there is a shared buffer of 64 KB for the console
            # writes. Attempt to not get ERROR_NOT_ENOUGH_MEMORY, see waf issue #746
            done = 0
            todo = len(txt)
            chunk = 32<<10
            while todo != 0:
                doing = min(chunk, todo)
                buf = txt[done:done+doing]
                r = writeconsole(self.hconsole, buf, doing, byref(chars_written), None)
                if r == 0:
                    chunk >>= 1
                    continue
                done += doing
                todo -= doing
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号