Suppose that exits an array like this:

Array QWORD 1.0,1.2,1.3,1.4,1.5
      QWORD 2.0,2.2,2.3,2.4,2.5
How can I save this to file and recuperate later?
Posted on 2001-04-26 19:34:00 by wolfao

.data
FileName  db "somefile.xxx",0
.data?
hFile         dd ?
BytesWritten  dd ?
.code
invoke CreateFile, ADDR FileName, GENERIC_WRITE, 0, 0,\
 CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
mov    hFile, eax
invoke WriteFile, hFIle, ADDR Array, 10*8, ADDR BytesWritten, NULL
.IF    eax==0 || BytesWritten!=10*8
  ;write error occurred
.ENDIF
invoke CloseHandle, hFile
This code creates a new file, and writes the data from the Array to the file (it writes 10*8 bytes, the total size in bytes of your array). Note that if the file already exists, it is overwritten. To read it again:

.data?
BytesRead  dd  ?
.code
invoke CreateFile, ADDR FileName, GENERIC_READ, 0, 0\
 OPEN_EXISTING, 0, 0
mov    hFile, eax
invoke ReadFile, hFile, ADDR Array, 10*8, ADDR BytesRead, 0
.IF    eax==0 || BytesRead!=10*8
 ;error occurred
.ENDIF
invoke CloseHandle, hFile
Thomas This message was edited by Thomas, on 4/27/2001 2:50:51 AM
Posted on 2001-04-27 02:50:00 by Thomas
Thanks very much!!! :)
Posted on 2001-04-27 07:11:00 by wolfao