Hello,

I 'm trying to use the Api WriteFile to add data in a file. These datas are strings.
When I declare this information in the section ".DATA" it's working

.DATA
mystring BYTE "The value"
pstring PBYTE mystring
...
invoke WriteFile,hFichier, pstring, SIZEOF string, addr nbrBytes, NULL


But, it is more complicated to use variable strings...

I don't know how to declare and affect a value to a variable mystring2

Help !

Thank you in advance.

Benxitd
Posted on 2004-07-20 12:55:29 by blank
Instead of pre-allocating space in your program, you can allocate some memory at run-time and use that to store your string. Iczelion has some tutorials which should answer your question. You can find them by doing a google or on this board itself. You might find tutorial 12 on memory management and file I/O particularly interesting.

You can use the memory copy function in the win32 API (memcpy, iirc) or use a loop to copy static data into a dynamic variable.
Posted on 2004-07-20 13:06:34 by jademtech
Thank you for your answer,
now I have to read...
Posted on 2004-07-21 10:42:20 by blank