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? | |||
| 
 | 
| 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! | |||
| 
 | 
| 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. | |||
| 
 | 
| 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 
 | |||||||||||
| 
 | 
| 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 | |||
| 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.