I have a problem, where I need to extract bytes from an array and then print those bytes to a disk file.
A simple operation of
mov wcnt, fwrite(hout,pdata,flen)
if the output were to be in the same order as the input.
As it is, specific bytes are to be extracted and written, byte by byte, to the disk file.
How do I do this in masm32?
Richard
Use
invoke CreateFile, with various parameters
invoke WriteFile, with various parameters
There are many examples of these two functions in the example code that comes with MASM32.
Also if you have a copy of the file Win32.hlp, available for download at various sites,
lookup the functions for an explanation of all the parameters.
A snippet from the file writdisk.asm from the M32LIB directory:
invoke CreateFile,lpName,GENERIC_WRITE,NULL,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL
invoke WriteFile,hOutput,lpData,fl,ADDR bw,NULL
The CREATE_ALWAYS can be replaced with OPEN_ALWAYS.
This could be done byte by byte, but it would be easier to extract the bytes and store them in a buffer, and then write the buffer to the output file.