|
libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
|
Files by path, and the stream over a C file. More...
#include <sdfio/reader.h>#include <sdfio/sdfio_export.h>#include <sdfio/types.h>#include <sdfio/writer.h>#include <stdio.h>#include <wchar.h>Go to the source code of this file.
Functions | |
| void | sdfio_stdio_stream (sdfio_stream *stream, FILE *file) |
| Creates a stream over a C file. | |
| sdfio_status | sdfio_open_file (sdfio_reader *reader, const char *path) |
| Opens the file at a path as the source and reads its header, as sdfio_open_stream() does for a stream. | |
| sdfio_status | sdfio_create_file (sdfio_writer *writer, const char *path, const sdfio_header *header) |
| Creates the file at a path and starts it as sdfio_create_stream() does. | |
| sdfio_status | sdfio_open_wfile (sdfio_reader *reader, const wchar_t *path) |
| Variant of sdfio_open_file() with a path of wide characters. | |
| sdfio_status | sdfio_create_wfile (sdfio_writer *writer, const wchar_t *path, const sdfio_header *header) |
| Variant of sdfio_create_file() with a path of wide characters. | |
Files by path, and the stream over a C file.
<sdfio/sdfio.h> does not include this header.
| sdfio_status sdfio_create_file | ( | sdfio_writer * | writer, |
| const char * | path, | ||
| const sdfio_header * | header ) |
Creates the file at a path and starts it as sdfio_create_stream() does.
An existing file is truncated. The data is written in place, and sdfio_end_file() closes the file. If the writing fails, the data written so far remains. A header that cannot be written creates no file.
| [in,out] | writer | The writer. |
| [in] | path | The path of the file. |
| [in] | header | The description of the file. |
| SDFIO_ERR_ARGUMENT | A pointer is null or the header cannot be written. |
| SDFIO_ERR_STATE | The writer has created a file already. |
| SDFIO_ERR_IO | The file cannot be created. |
| sdfio_status sdfio_create_wfile | ( | sdfio_writer * | writer, |
| const wchar_t * | path, | ||
| const sdfio_header * | header ) |
Variant of sdfio_create_file() with a path of wide characters.
| [in,out] | writer | The writer. |
| [in] | path | The path of the file. |
| [in] | header | The description of the file. |
| sdfio_status sdfio_open_file | ( | sdfio_reader * | reader, |
| const char * | path ) |
Opens the file at a path as the source and reads its header, as sdfio_open_stream() does for a stream.
The reader closes the file when it is freed or when the open fails.
| [in,out] | reader | The reader. |
| [in] | path | The path of the file. |
| SDFIO_ERR_ARGUMENT | A pointer is null. |
| SDFIO_ERR_IO | The file cannot be opened. |
| sdfio_status sdfio_open_wfile | ( | sdfio_reader * | reader, |
| const wchar_t * | path ) |
Variant of sdfio_open_file() with a path of wide characters.
| [in,out] | reader | The reader. |
| [in] | path | The path of the file. |
| void sdfio_stdio_stream | ( | sdfio_stream * | stream, |
| FILE * | file ) |
Creates a stream over a C file.
The file remains owned by the caller and is not closed.
The file must be open in binary mode. On Windows stdin and stdout are in text mode, which translates line ends and treats the byte 0x1A as the end of the input. Switch them before the first use with _setmode(_fileno(stdin), _O_BINARY). The files of sdfio_open_file() and sdfio_create_file() are always binary.
| [out] | stream | The stream, whose user is the file. |
| [in] | file | The C file. |