distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::anonymous_namespace{openFile.cpp} Namespace Reference

Functions

int fileClose (void *const cookie)
 Wrapper for File::close() which can be used with fopencookie() More...
 
ssize_t fileRead (void *const cookie, char *const buffer, const size_t size)
 Wrapper for File::read() which can be used with fopencookie() More...
 
int fileSeek (void *const cookie, off_t *const offset, const int whence)
 Wrapper for File::seek() which can be used with fopencookie() More...
 
ssize_t fileWrite (void *const cookie, const char *const buffer, const size_t size)
 Wrapper for File::write() which can be used with fopencookie() More...
 

Function Documentation

◆ fileClose()

int distortos::anonymous_namespace{openFile.cpp}::fileClose ( void *const  cookie)

Wrapper for File::close() which can be used with fopencookie()

Parameters
[in]cookieis a cookie which was passed to fopencookie(), must be File!
Returns
0 on success, -1 otherwise; writes error code to errno:

◆ fileRead()

ssize_t distortos::anonymous_namespace{openFile.cpp}::fileRead ( void *const  cookie,
char *const  buffer,
const size_t  size 
)

Wrapper for File::read() which can be used with fopencookie()

Parameters
[in]cookieis a cookie which was passed to fopencookie(), must be File!
[out]bufferis the buffer into which the data will be read
[in]sizeis the size of buffer, bytes
Returns
0 on success, -1 otherwise; writes error code to errno:

◆ fileSeek()

int distortos::anonymous_namespace{openFile.cpp}::fileSeek ( void *const  cookie,
off_t *const  offset,
const int  whence 
)

Wrapper for File::seek() which can be used with fopencookie()

Parameters
[in]cookieis a cookie which was passed to fopencookie(), must be File!
[in,out]offsetis a pointer the value of offset, bytes
[in]whenceselects the mode of operation: SEEK_SET will set file offset to offset, SEEK_CUR will set file offset to its current value plus offset, SEEK_END will set file offset to the size of the file plus offset
Returns
0 on success, -1 otherwise; writes error code to errno:
  • EINVAL - whence is not valid;
  • error codes returned by File::seek();

◆ fileWrite()

ssize_t distortos::anonymous_namespace{openFile.cpp}::fileWrite ( void *const  cookie,
const char *const  buffer,
const size_t  size 
)

Wrapper for File::write() which can be used with fopencookie()

Parameters
[in]cookieis a cookie which was passed to fopencookie(), must be File!
[in]bufferis the buffer with data that will be written
[in]sizeis the size of buffer, bytes
Returns
0 on success, -1 otherwise; writes error code to errno: