mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-30 12:17:56 +00:00
make tmemfile2 work again
This commit is contained in:
@@ -18,8 +18,9 @@ mm.close()
|
||||
|
||||
# read, change
|
||||
mm_full = memfiles.open(fn, mode = fmWrite, mappedSize = -1, allowRemap = true)
|
||||
echo "Full read size: ",mm_full.size
|
||||
let size = mm_full.size
|
||||
p = mm_full.mapMem(fmReadWrite, 20, 0)
|
||||
echo "Full read size: ", size
|
||||
var p2 = cast[cstring](p)
|
||||
p2[0] = 'H'
|
||||
p2[1] = 'e'
|
||||
@@ -32,7 +33,7 @@ mm_full.close()
|
||||
|
||||
# read half, and verify data change
|
||||
mm_half = memfiles.open(fn, mode = fmRead, mappedSize = 10)
|
||||
echo "Half read size: ",mm_half.size, " Data: ", cast[cstring](mm_half.mem)
|
||||
echo "Half read size: ", mm_half.size, " Data: ", cast[cstring](mm_half.mem)
|
||||
mm_half.close()
|
||||
|
||||
if fileExists(fn): removeFile(fn)
|
||||
|
||||
Reference in New Issue
Block a user