assembly - NASM 中的文件编辑逆境
问题描述
我想创建一个创建、打开、编辑然后关闭文件的程序,目的是将“hello”写入文件,但不是编辑文件,而是创建一个名为“tfile.txt”的文件,然后将名称编辑为 'tfile.txtHello'$'001'。请帮忙。
section .data
idfile db '/home/alvaro/nasm/tfile.txt'
msgfile db 'Hello'
lonmsg equ $-msgfile
section .text
global _start
_start:
mov eax, 8
mov ebx, idfile
mov ecx, 777o
int 0x80
_openfile:
mov eax, 5
mov ebx, [idfile]
mov ecx, 777o
int 0x80
_editfile:
mov eax, 4
mov ebx, [idfile]
mov ecx, [msgfile]
mov edx, lonmsg
int 0x80
_closefile:
mov eax, 6
mov ebx, [idfile]
int 0x80
_finalize:
mov eax, 1
mov ebx, 0
int 0x80
解决方案
推荐阅读
- c - 我不知道如何让我的程序读取文件
- angularjs - 如何在 AngularJs 常量中使用全局常量
- html - 如果单击更改按钮,为什么背景颜色没有改变?
- python - 加速 Ising-/Potts-Model Monte-Carlo 的 Python/Numpy 代码
- machine-learning - 使用 20000 个样本进行 MLPClassifier 模型精度微调
- tree - 接受二叉树并返回总和的函数
- android - app:backgroundTint 对 ViewGroup 没有影响
- php - MySQL 是否具有针对基于 URL 的攻击的内置注入攻击保护?
- zlib - zlib 在 Z_STREAM_END 之后继续膨胀
- python - 在您为应用程序应用迁移之前,项目可能无法正常工作,但迁移不起作用