Wheefun I/O Library  0.0.5
Useful I/O Primitives.
Classes | Namespaces | Functions
stdio.h File Reference

STDIO interaction. More...

#include <wfio/type.h>
#include <stdio.h>

Go to the source code of this file.

Classes

class  wfio::StdioDevice
 A Device wrapping a standard IO device. More...
 

Namespaces

 wfio
 The root namespace for WFIO.
 

Functions

WFIO_C_BEGIN WFIO_DLL struct wfio_device_twfio_device_from_stdio (FILE *handle, int *error)
 Wrap the device with the given filehandle handle. More...
 
WFIO_DLL_FASTCALL size_t wfio_stdio_getbufsz (FILE *handle, int *error)
 Obtain the buffer size associated with this handle. More...
 
WFIO_DLL_FASTCALL wfio_fd_t wfio_stdio_to_fd (FILE *handle, int *error)
 Attempt to convert handle to a file descriptor. More...
 

Detailed Description

STDIO interaction.

Author
Phillip Kilgore
Since
0.0.1
Note
This file includes <stdio.h>.

Function Documentation

◆ wfio_device_from_stdio()

WFIO_C_BEGIN WFIO_DLL struct wfio_device_t* wfio_device_from_stdio ( FILE *  handle,
int *  error 
)

Wrap the device with the given filehandle handle.

This function wraps an already open FILE* produced by the standard library. The new device takes ownership of the FILE* in the process. The device behaves as thought the corresponding STDIO calls were made.

Calling wfio_device_ioctl() on this device occurs in a purely implementation-defined manner. If file descriptors are supported, then this is equivalent to invoking this function on a file desciptor device (see wfio_device_from_fd()).

Parameters
handleThe file handle to wrap.
errorAn optional error indicator.
Returns
An open wfar_device_t on success; otherwise, NULL.

◆ wfio_stdio_getbufsz()

WFIO_DLL_FASTCALL size_t wfio_stdio_getbufsz ( FILE *  handle,
int *  error 
)

Obtain the buffer size associated with this handle.

Parameters
handleThe file handle to get the buffer size for.
errorAn optional error indicator.
Returns
The size of the buffer on success; otherwise, WFIO_NPOS.

◆ wfio_stdio_to_fd()

WFIO_DLL_FASTCALL wfio_fd_t wfio_stdio_to_fd ( FILE *  handle,
int *  error 
)

Attempt to convert handle to a file descriptor.

Parameters
handleThe file handle to convert.
errorAn optional error indicator.
Returns
The file descriptor corresponding to handle on success; otherwise, WFIO_BAD_FD.