【问题标题】:Printing on the same line using printf in nasm在 nasm 中使用 printf 在同一行上打印
【发布时间】:2010-12-11 12:56:00
【问题描述】:

我希望能够打印到同一行,同时在 nasm 程序集中多次调用 printf。

例如:

SEGMENT .text
mov eax,5
push eax
push format_num
call printf
add esp,8

...other code

mov eax,6
push eax
push format_num
call printf
add esp,8

SEGMENT .data
format_num db "%d",10,0

结果

5
6

而我想要

56

由于 10 代表换行符,我会认为使用

format_num db "%d",0

会起作用,但这不会导致打印任何内容。

【问题讨论】:

    标签: printf nasm


    【解决方案1】:

    打印后刷新标准输出。

    【讨论】:

      猜你喜欢
      • 2015-04-12
      • 2015-09-17
      • 2013-12-14
      • 2016-01-25
      • 2015-06-09
      • 2019-07-06
      • 1970-01-01
      • 1970-01-01
      • 2020-06-07
      相关资源
      最近更新 更多