Skip to content

Modern Fs MemoryMappedFile Size

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Filesystem › Filesystem Library › MemoryMappedFile.Size

MemoryMappedFile.Size

Returns the size of the mapped file in bytes.

Syntax

MemoryMappedFile.Size( )

Notes

  • ulongint

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "hello" )

dim mm as MemoryMappedFile
mm.Open( p )

print mm.Size( )             '' 5 -- the mapped length, in bytes

'' The bound for Data( ): there is no terminator, so this is the only
'' thing that says where the mapping ends
dim as uint8 ptr b = mm.Data( )
for i as uint64 = 0 to mm.Size( ) - 1
    print chr( b[ i ] );
next
print                        '' hello

mm.Close( )

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Locking, Mapping And Watching

Clone this wiki locally