Skip to content

Modern Fs RecordCount

Paul Squires edited this page Oct 24, 2026 · 1 revision

Home › Filesystem › File Streams › RecordCount

RecordCount

Returns the number of whole records of a type in an open File.

Syntax

RecordCount( of T )( f )                 '' FsResultI64

Notes

  • The file's size divided by sizeof( T ). A short last record is not counted.

Examples

#import "std/fs"
using fs

type Score field = 1
    player as long
    points as long
end type

dim as RecordFile( of Score ) rf
rf.Open( "scores.dat" )
dim as Score s
rf.Append( s )
rf.Append( s )
rf.Close( )

dim as File f
f.OpenRead( "scores.dat" )
print RecordCount( of Score )( f ).Value( )    '' 2
f.Close( )
RemoveFile( "scores.dat" )

Library: Filesystem Library Category: File Streams Documented under: Records

Clone this wiki locally