Skip to content

Modern Fs Copy

Paul Squires edited this page Oct 22, 2026 · 3 revisions

Home › Filesystem › File Streams › Copy

Copy

Copies a stream from its position to its end into another; returns the byte count.

Syntax

Copy( src, dst [, bufSize ] )

Notes

  • Reads src from its position to its end and writes everything to dst with WriteAll. Returns the number of bytes copied.
  • dst is not flushed.
  • A failure on either side keeps its code and native code, with Operation "Copy". bufSize below 1 is FS_INVALID_ARGUMENT; the default is 65536.

Examples

#import "std/fs"
using fs


dim as MemoryStream src = MemoryStream( "copy me" )
dim as MemoryStream dst
print Copy( src, dst ).Value( )    '' 7
print dst.ToUtf8Text( )            '' copy me

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

Clone this wiki locally