bahar1370
سه شنبه 20 فروردین 1392, 22:05 عصر
سلام
برای نوشتن در یک فایل باید از چه دستوری استفاده کنم ؟؟؟ برای ویندوز با api برای masm32
ممنون
programer-ir
پنج شنبه 22 فروردین 1392, 00:08 صبح
.386
.model flat,stdcall
option casemap:none ; Case Sensitive
; Windows
include \masm32\include\windows.inc
; Kernel32
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
.data
FilePath db "C:\test.txt",0
WriteText db "This is some test text."
.code
start:
; Edit a file
invoke CreateFile, addr FilePath, GENERIC_WRITE, FILE_SHARE_WRITE or FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL
push eax ; save the file handle
; This works other than the crashing, any number less then 23
; and the file has some of the text clipped
; any larger and NUL is appended until the byte count is matched.
invoke WriteFile, eax, addr WriteText, 15, NULL, NULL
pop eax
push eax
invoke CloseHandle, eax
invoke ExitProcess, 0
end start
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.