-
-
[救助]关于WriteFile写文件问题........
-
发表于:
2006-12-1 23:11
5395
-
[救助]关于WriteFile写文件问题........
我写了一个代码,如下:
.386
.model flat,stdcall
option casemap:none
include windows.inc
include kernel32.inc
include user32.inc
includelib kernel32.lib
includelib user32.lib
.data
szLogFile db "C:\test.txt",0
lpBuffer db '床前明月光,疑是地上霜.举头望明月,低头思故乡.',0
lpNumberOfBytesRead db 100 dup(?)
.code
start:
_test proc
LOCAL @hFile:DWORD
invoke CreateFile,addr szLogFile,GENERIC_WRITE,FILE_SHARE_READ,\
0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov @hFile,eax
.if eax != NULL
invoke WriteFile,@hFile,addr lpBuffer,44,addr lpNumberOfBytesRead,NULL
.endif
ret
_test endp
call _test
invoke ExitProcess,NULL
end start
这样写入一个文本文件后,就是一排过去:
“床前明月光,疑是地上霜.举头望明月,低头思故乡.”
现在我想写成这样的形式:
床前明月光,
疑是地上霜.
举头望明月,
低头思故乡.
该怎么实现?
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)