使用系统调用写入文件在NASM [英] writing to a file in nasm using system calls
本文介绍了使用系统调用写入文件在NASM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
作为转让的一部分,我应该写使用系统调用的文件。一切正常,除非我尝试打开gedit的(Linux)的文件很好,它说,它无法识别的字符编码。记事本(在Windows上)打开文件就好了。为什么不能在Linux上运行?
As part of an assignment I'm supposed to write to a file using system calls. Everything works fine except when I try to open the file in gedit (linux), it says it can't identify the character encoding. Notepad (on windows) opens the file just fine. Why doesn't it work on linux ?
这里的code:
section .text
global _start
_start:
mov EAX, 8
mov EBX, filename
mov ECX, 0700
int 0x80
mov EBX, EAX
mov EAX, 4
mov ECX, text
mov EDX, textlen
int 0x80
mov EAX, 6
int 0x80
mov eax, 1
int 0x80
section .data
filename db "./output.txt", 0
text db "hello world", 0
textlen equ $ - text
感谢:)
- 更新:新增输出字符串后换行字符,它固定它
-- update: added a linefeed character after the output string and it fixed it.
推荐答案
固定它,请参阅更新的问题。
fixed it, see update in the question.
这篇关于使用系统调用写入文件在NASM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文