Go to the documentation of this file.
76 #define XS_MAX_FILENAME_LENGTH 512
78 #define XS_MAX_FILENAME_LENGTH PATH_MAX
86 #define XSFILE_INITIALIZER { 0 }
165 return XsFile_open(
this, &fileName, readOnly ? 1 : 0);
181 inline bool isOpen()
const
225 return XsFile_read(
this, destination, size, count);
237 return XsFile_write(
this, source.data(), 1, source.size());
253 inline char* gets(
char* destination,
int maxCount)
283 inline bool eof()
const
312 line = tmp.toStdString();
317 inline FILE* handle()
ROSCPP_DECL bool exists(const std::string &service_name, bool print_failure_reason)
A list of uint8_t values.
XsResultValue XsFile_flush(struct XsFile *thisPtr)
Writes unwritten data to the file.
int XsFile_getc(struct XsFile *thisPtr)
Gets and returns the next byte from a file.
XsResultValue XsFile_error(struct XsFile const *thisPtr)
XsResultValue XsFile_putc(struct XsFile *thisPtr, int character)
Writes a character to the file.
XsResultValue XsFile_getline(struct XsFile *thisPtr, struct XsString *line)
Reads a full line from the file.
XsResultValue XsFile_seek_r(struct XsFile *thisPtr, XsFilePos offset)
Moves the current file position relative to the end of the file.
XsResultValue XsFile_resize(struct XsFile *thisPtr, XsFilePos fileSize)
Resizes the file to fileSize bytes.
int XsFile_exists(const struct XsString *filename)
Checks if the file exists (can be accessed)
int XsFile_isOpen(const struct XsFile *thisPtr)
Checks if a file is open.
void XsFile_destruct(struct XsFile *thisPtr)
Frees the resources of this object by closing the file if it is open.
XsResultValue XsFile_truncate(struct XsFile *thisPtr, XsFilePos fileSize)
Reduces the file to a maximum size of fileSize bytes.
@ XRV_OK
0: Operation was performed successfully
XsResultValue
Xsens result values.
XsResultValue XsFile_puts(struct XsFile *thisPtr, const char *str)
Writes a null terminated c-string to the file.
XsResultValue XsFile_reopen(struct XsFile *thisPtr, const struct XsString *filename, const struct XsString *mode)
Reopens a file.
char * XsFile_gets(struct XsFile *thisPtr, char *str, int num)
Reads characters from this file and stores them into str until (num-1) characters have been read or e...
XsResultValue XsFile_open(struct XsFile *thisPtr, const struct XsString *filename, int readOnly)
Opens an existing binary file with name filename.
XsResultValue XsFile_create(struct XsFile *thisPtr, const struct XsString *filename, int writeOnly)
Creates a new binary file with name filename, contents of existing files will be discarded.
XsResultValue XsFile_openText(struct XsFile *thisPtr, const struct XsString *filename, int readOnly)
Opens an existing binary file with name filename.
XsResultValue XsFile_close(struct XsFile *thisPtr)
Closes the file.
FILE * XsFile_handle(struct XsFile *thisPtr)
Encapsulates a file, providing a platform independent interface.
XsResultValue XsFile_seek(struct XsFile *thisPtr, XsFilePos offset)
Moves the current file position relative to the start of the file.
XsResultValue XsFile_erase(const struct XsString *filename)
Deletes a file with name filename.
XsResultValue XsFile_fullPath(const struct XsString *filename, struct XsString *fullPath)
Retrieves the full path for a filename.
XsFilePos XsFile_write(struct XsFile *thisPtr, const void *source, XsFilePos size, XsFilePos count)
Writes a number of elements to a file.
int XsFile_eof(struct XsFile const *thisPtr)
XsResultValue XsFile_createText(struct XsFile *thisPtr, const struct XsString *filename, int writeOnly)
Creates a new text file with name filename, contents of existing files will be discarded.
int64_t XsFilePos
The type that is used for positioning inside a file.
A 0-terminated managed string of characters.
XsFilePos XsFile_tell(struct XsFile const *thisPtr)
Returns the current position in the file.
XsFilePos XsFile_read(struct XsFile *thisPtr, void *destination, XsFilePos size, XsFilePos count)
Reads a number of elements from a file.