# PxIOFileCreate

> Source: https://manual.pvxplus.com/pxio-library/library-functions/file-maintenance-functions/pxiofilecreate

## Description

Creates a PxPlus file

## Format

**int** **PxIOFileCreate(PxIOService service, const char \*pathname, PxIOFileType type, unsigned int recordSize, unsigned int keySize, unsigned int maxRecordNumber, const char \*keyDefinitions, unsigned int options, unsigned intblockSize, unsigned char fieldSeparator);**

***Where:***

|  |  |
| --- | --- |
| **service** | PxIO service to use to create the file. This is required for security purposes. |
| **pathname** | Pathname of the file to be created |
| **type** | Type of PxPlus file to create. See **[Appendix D](https://manual.pvxplus.com/pxio-library/library-functions/appendix-references/appendix-d)** for a list of currently allowed types. |
| **recordSize** | Maximum size of a record in the file to be created |
| **keySize** | Size of a key in the new file |
| **maxRecordNumber** | Maximum number of records allowed in the new file. Use 0 for unlimited. |
| **keyDefinitions** | A pointer to a buffer containing key definitions for the file being created. See **[Key Definitions](https://manual.pvxplus.com/pxplus-user-guide/file-handling/data-files/keyed-files#keydef)**. |
| **options** | A bit array containing file creation options. See **[Appendix E](https://manual.pvxplus.com/pxio-library/library-functions/appendix-references/appendix-e)** for a list of currently allowed options. |
| **blockSize** | Block size in kilobytes for the file to be created |
| **fieldSeparator** | Field separator to be used by the file |

## Return Value

If the function succeeds, a value of PXIO_SUCCESS_STATUS is returned; otherwise, an error value is returned. More information on the nature of the error can be found by calling **[PxIOGetError](https://manual.pvxplus.com/pxio-library/library-functions/error-functions/pxiogeterror)**.

Note:  
The service must be included for security purposes, and the pathname is relative to the service. For a remote service using PxServer, the path is relative to the machine on which PxServer is running.
