---
name: "savephfig"
section: "3"
platform: "linux"
package: "alliance"
version: "5.1.1-3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/savephfig"
---

# savephfig(3)

save a physical figure on disk

## NAME

savephfig - save a physical figure on disk

## SYNOPSYS

```
#include "mpu.h"
void savephfig(ptfig)
phfig_list ∗ptfig;
```

## PARAMETER

- *ptfig*

  Pointer to the *phfig* to write on disk

## DESCRIPTION

**savephfig** writes on disk the contents of the figure pointer to by  *ptfig*. All the figure lists are ran through, and the appropriate objects written, independently of the figure *mode*. \
 The **savephfig** function in fact performs a call to a driver, choosen by the [*MBK\_OUT\_PH*(1)](/MBK_OUT_PH/1.md) environment variable. The directory in which the file is to be written is the one set by [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md). See [**MBK\_OUT\_PH**(1)](/MBK_OUT_PH/1.md), [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md) and [**mbkenv**(3)](/mbkenv/3.md) for details.

## ERRORS

**"∗∗∗ mbk error ∗∗∗ not supported physical output format 'xxx'"**

The environment variable *MBK\_OUT\_PH* is not set to a legal physical format.

**"∗∗∗ mbk error ∗∗∗ savephfig : could not open file** *figname.ext***"**

Either the directory or the file are write protected, so it's not possible to open *figname.ext*, where *ext* is the file format extension, for  writting.

## EXAMPLE

```
#include "mpu.h"
void save_na2_y()
{
	savephfig(getphfig("na2_y"));
}
```

## SEE ALSO

**mbk**(1), [**mbkenv**(3)](/mbkenv/3.md), [**phfig**(3)](/phfig/3.md), [**addphfig**(3)](/addphfig/3.md), [**getphfig**(3)](/getphfig/3.md), [**delphfig**(3)](/delphfig/3.md), [**loadphfig**(3)](/loadphfig/3.md), [**flattenphfig**(3)](/flattenphfig/3.md), [**rflattenphfig**(3)](/rflattenphfig/3.md), [**MBK\_OUT\_PH**(1)](/MBK_OUT_PH/1.md), [**MBK\_WORK\_LIB**(1)](/MBK_WORK_LIB/1.md).
