---
name: "PS_open_file"
section: "3"
platform: "linux"
package: "pslib-dev"
version: "0.4.8-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PS_open_file"
---

# PS\_open\_file(3)

Opens a file for output

## NAME

PS\_open\_file — Opens a file for output

## SYNOPSIS

\#include \<pslib.h\>

int PS\_open\_file(PSDoc \*psdoc, const char \*filename)

## DESCRIPTION

Creates a new file on disk and writes the PostScript document into  it. The file will be closed when [PS\_close(3)](/PS_close/3.md) is called. If  **filename** is NULL, empty or \`-', then the file  will be created in memory and retrieved with  **[PS\_get\_buffer(3)](/PS_get_buffer/3.md)**.

## RETURN VALUE

Returns -1 in case of an error and 0 otherwise.

## SEE ALSO

[PS\_open\_fp(3)](/PS_open_fp/3.md), [PS\_open\_mem(3)](/PS_open_mem/3.md), [PS\_close(3)](/PS_close/3.md), [PS\_get\_buffer(3)](/PS_get_buffer/3.md)

## AUTHOR

This manual page was written by Uwe Steinmann uwe@steinmann.cx.
