flat assembler
Message board for the users of flat assembler.
Index
> Windows > me again, file functions |
Author |
|
revolution 14 May 2009, 15:52
Dreamz wrote: how do you define the contents of the file? Dreamz wrote: how do you copy a file? |
|||
14 May 2009, 15:52 |
|
Dreamz 14 May 2009, 15:59
well i mean im almost a complete beginner, could you give an example, like:
Code: include 'win32ax.inc' .code start: invoke CreateFile,echo,GENERIC_WRITE,\ FILE_SHARE_READ,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 invoke ExitProcess,0 .end start echo db 'G:\Hey.txt',0 or Code: invoke CreateFile,echo,GENERIC_WRITE,\ FILE_SHARE_READ,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0 ... ... echo db 'G:\Hey.txt',0 that is if its rly big thanks! |
|||
14 May 2009, 15:59 |
|
bitshifter 15 May 2009, 02:14
Open a file, get its size, allocate a buffer and read in the data.
*takes breath* Close the file, create a new file, write the data, close the file. For reading a file into a dynamic buffer study my texture loader. http://board.flatassembler.net/topic.php?t=9885 _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
15 May 2009, 02:14 |
|
wht36 16 Jun 2009, 10:29
To copy a file, you need to:
1. open the source file, 2. open the destination file 3. read the contents of source file into a buffer 4. write the contents of the buffer to the destination file see attached exampled asm
|
|||||||||||
16 Jun 2009, 10:29 |
|
eskizo 17 Jun 2009, 16:25
this is the "begginer" example:
Code: include 'include\win32ax.inc' .code start: invoke CreateFile, fname, GENERIC_WRITE, FILE_SHARE_READ,\ 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 mov [fhandle], eax invoke WriteFile, eax, fname, 10, garbage, 0 invoke CloseHandle, fhandle invoke ExitProcess, 0 .end start fname db 'HelloWorld.txt',0 fhandle dd 0 garbage dd 0 ;necessary cya |
|||
17 Jun 2009, 16:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.