---
name: "afCloseFile"
section: "3"
platform: "linux"
package: "audiofile"
version: "0.3.6-12"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/afCloseFile"
---

# afCloseFile(3)

close an open audio file

## NAME

afCloseFile - close an open audio file

## SYNOPSIS

```
#include <audiofile.h>
```

```
int afCloseFile(AFfilehandle file);
```

## PARAMETERS

file is a valid file handle created by [**afOpenFile**(3)](/afOpenFile/3.md).

## DESCRIPTION

afCloseFile closes the audio file *file*, updating the file if it was opened for writing.

## RETURN VALUE

afCloseFile returns 0 if the file was closed properly and -1 if an error occurred while closing the file.

## ERRORS

afCloseFile can generate these possible errors:

•

AF\_BAD\_FILEHANDLE

•

AF\_BAD\_LSEEK

•

AF\_BAD\_WRITE

## SEE ALSO

[**afOpenFile**(3)](/afOpenFile/3.md)

## AUTHOR

Michael Pruett \<michael@68k.org\>
