Hello everybody,

Does anybody know how to write say 100 bytes of same character to a file? I know how to use WriteFile but I want to be able to fill 100 bytes of it with 03, 03, 03... over and over again.

How to do this? Any suggestions appreciated.

best regards,

czDrillard
Posted on 2001-08-05 01:05:07 by czDrillard
cz,

Its probably easier to fill a buffer with the repeated byte sequence you want and then write it to disk, making multiple "WriteFile" calls to write a byte at a time is not a good way to do it.

Regards,

hutch@pbq.com.au
Posted on 2001-08-05 01:19:32 by hutch--
Thanks hutch,
I suspected that might be the way to go but I thought maybe there was another way like somebody told me about a command called Fill Memory or something like that.

best regards,

czDrillard
Posted on 2001-08-05 12:16:21 by czDrillard
you can memorymap a file so you can use stosb/movsb
or fillmem/whatever. look in your api ref (createfilemaping?)
Posted on 2001-08-05 13:14:22 by blabla
Yep, I was using memfill today and that will do the trick.

invoke memfill, addr szBuffer, 100, 3
invoke _lwrite, hFile, addr szBuffer, 100

part of the MASM32 Library
Posted on 2001-08-06 01:06:28 by dl?