Think I was a bit too fast with "beautiful".
This is perfect.
include \masm32\MasmBasic\MasmBasic.inc ; download
Init
GetFolders "C:\"
xchg eax, ecx ; save the count
Insert Files$(0)
Let Files$(0)=Str$("%i", ecx)
Store "Folders_C.txt", Files$()
EndOfCode
But this is not what I meant.
hMem dd ?
store_file db "Folders_C.txt", 0
Init
;FileWrite offset store_file, "Hello" ; make sure it exists
Let hMem=FileRead$(offset store_file)
Inkey "[", hMem, "]"
EndOfCode
But...
Read the existing "Folders_C.txt and mov the content into Files$ for further use.
Something like...
mov hMem,alloc(5000000)
INVOKE CreateFile,offset store_file,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
mov filehandle,eax
INVOKE GetFileSize,filehandle,0
mov myfilesize,eax
INVOKE ReadFile,filehandle,hMem,myfilesize,offset BytesRead,0
INVOKE CloseHandle,filehandle
Now I have the storefile in hMem and want to get it into MasmBasics Files$