NVBIO
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions
hfile.h File Reference
#include <string.h>
#include <sys/types.h>
#include "hts_defs.h"

Go to the source code of this file.

Classes

struct  hFILE
 

Typedefs

typedef struct hFILE hFILE
 

Functions

hFILEhopen (const char *filename, const char *mode) HTS_RESULT_USED
 
hFILEhdopen (int fd, const char *mode) HTS_RESULT_USED
 
int hclose (hFILE *fp) HTS_RESULT_USED
 
void hclose_abruptly (hFILE *fp)
 
off_t hseek (hFILE *fp, off_t offset, int whence) HTS_RESULT_USED
 
ssize_t hpeek (hFILE *fp, void *buffer, size_t nbytes) HTS_RESULT_USED
 
int hflush (hFILE *fp) HTS_RESULT_USED
 

Typedef Documentation

typedef struct hFILE hFILE

Function Documentation

int hclose ( hFILE fp)

Flush (for output streams) and close the stream

Returns
0 if successful, or EOF (with errno set) if an error occurred.

Definition at line 269 of file hfile.c.

void hclose_abruptly ( hFILE fp)

Close the stream, without flushing or propagating errors For use while cleaning up after an error only. Preserves errno.

Definition at line 284 of file hfile.c.

hFILE* hdopen ( int  fd,
const char *  mode 
)

Associate a stream with an existing open file descriptor

Returns
An hFILE pointer, or NULL (with errno set) if an error occurred. For socket descriptors (on Windows), mode should contain 's'.

Definition at line 407 of file hfile.c.

int hflush ( hFILE fp)

For writing streams, flush buffered output to the underlying stream

Returns
0 if successful, or EOF if an error occurred.

Definition at line 200 of file hfile.c.

hFILE* hopen ( const char *  filename,
const char *  mode 
)

Open the named file or URL as a stream

Returns
An hFILE pointer, or NULL (with errno set) if an error occurred.

Definition at line 519 of file hfile.c.

ssize_t hpeek ( hFILE fp,
void *  buffer,
size_t  nbytes 
)

Peek at characters to be read without removing them from buffers

Parameters
fpThe file stream
bufferThe buffer to which the peeked bytes will be written
nbytesThe number of bytes to peek at; limited by the size of the internal buffer, which could be as small as 4K.
Returns
The number of bytes peeked, which may be less than nbytes if EOF is encountered; or negative, if there was an I/O error. The characters peeked at remain in the stream's internal buffer, and will be returned by later hread() etc calls.

Definition at line 135 of file hfile.c.

off_t hseek ( hFILE fp,
off_t  offset,
int  whence 
)

Reposition the read/write stream offset

Returns
The resulting offset within the stream (as per lseek(2)), or negative if an error occurred.

Definition at line 249 of file hfile.c.