top of page

Common I/O Tasks

 

The xtd.io namespace provides several classes that allow for various actions, such as reading and writing, to be performed on files, directories, and streams. For more information, see File and Stream I/O.

Preamble

 

Prefer in your application to use the Input/output library and Filesystem library of the std.

xtd has its own IO API because the Filesystem library doesn't work on all OS (like for example iOS).

Some features exist only in the xtd API like binary reader/writerstream reader/writerstring reader/writer and text reader/writer.

Common File Tasks

 To do this... 

Create a text file

Write to a text file

Read from a text file

Append text to a file

Rename or move a file

Delete a file

Copy a file

Get the size of a file

Get the attributes of a file

Set the attributes of a file

Determine whether a file exists

Read from a binary file

Write to a binary file

Retrieve a file name extension

Retrieve the fully qualified path of a file

Retrieve the file name and extension from a path

Change the extension of a file

Common Directory Tasks

 To do this... 

Access a file in a special folder such as My Documents

Create a directory

Create a subdirectory

Rename or move a directory

Copy a directory

Delete a directory

See the files and subdirectories in a directory

Find the size of a directory

Determine whether a directory exists

See also

bottom of page