Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
File class
#1
How i can read my data file in memory buffer or any array used the File class or Windows API functions? Give me example, please.
#2
To load whole file, use this:

Macro Macro1599
Code:
Copy      Help
str s
s.getfile("$desktop$\test\test.txt")

When need more control, I use Windows API. Example:

Macro Macro1598
Code:
Copy      Help
out

;Opens file. Repeatedly reads into a fixed size buffer until end of file.

__HFile f.Create("$desktop$\test\test.txt" OPEN_EXISTING GENERIC_READ FILE_SHARE_READ) ;;open file for read
str b.all(1024 2) ;;allocate 1 KB of memory
int nbRead
rep
,if(!ReadFile(f b b.len &nbRead 0)) end _s.dllerror
,if(nbRead=0) break ;;end of file
,
,out nbRead
,outb b nbRead 1


Forum Jump:


Users browsing this thread: 1 Guest(s)