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

# PX\_create\_fp(3)

create a new Paradox file

## NAME

PX\_create\_fp — create a new Paradox file

## SYNOPSIS

\#include \<paradox.h\>

int PX\_create\_fp(pxdoc\_t \*pxdoc, pxfield\_t \*fields, int numfields, FILE \*fp, int type)

## DESCRIPTION

Creates a new Paradox document in an already open file with the given  field specification. **pxdoc** must be created before  with **[PX\_new(3)](/PX_new/3.md)** or **[PX\_new2(3)](/PX_new2/3.md)**.  The file must be opened in read/write mode  (w+) with **[fopen(3)](/fopen/3.md)**. **fields** is an  array of **numfields** field specifications to set the  schema of the database. The memory for the field specifications and  field names must be allocated by the caller and may not be freed, since  the memory is freed when the document is deleted. Make sure to use the  same memory allocation function as passed to  **[PX\_new(3)](/PX_new/3.md)**. The memory for the field names is  usually allocated with **[PX\_strdup(3)](/PX_strdup/3.md)**.  The field name can be  left empty if a primary index file is to be created. The type of the  file can be set in the last parameter. Currently only database  (pxfFileTypIndexDB, pxfFileTypNonIndexDB) and  primary index (pxfFileTypPrimIndex) files are supported.

After creating the paradox database you may want to call  **[PX\_set\_tablename(3)](/PX_set_tablename/3.md)** in order to set the table  name as it is stored in the header of the database.

## RETURN VALUE

Returns 0 on success and -1 on failure.

## SEE ALSO

[PX\_new2(3)](/PX_new2/3.md), [PX\_new(3)](/PX_new/3.md), [PX\_create\_file(3)](/PX_create_file/3.md), [PX\_set\_tablename(3)](/PX_set_tablename/3.md)

## AUTHOR

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