---
title: Adopting Swift File Operations
framework: system
role: article
role_heading: Article
path: system/adopting-file-operations
---

# Adopting Swift File Operations

Migrate existing C code to Swift, using the file operations provided by the System module.

## Overview

Overview The C functions for file operations map to Swift as follows: close ⟶ close() lseek ⟶ seek(offset:from:)   open ⟶ open(_:_:options:permissions:retryOnInterrupt:) pread ⟶ read(fromAbsoluteOffset:into:retryOnInterrupt:) pwrite ⟶ write(toAbsoluteOffset:_:retryOnInterrupt:) read ⟶ read(into:retryOnInterrupt:) write ⟶ write(_:retryOnInterrupt:)

## See Also

### Adopting System

- [Adopting Swift File Options](system/adopting-file-options.md)
- [Adopting Swift Error Constants](system/adopting-errno.md)
