Rockbox Technical Forums

Rockbox Development => Starting Development and Compiling => Topic started by: deute on December 20, 2011, 09:45:18 AM

Title: creating/editing (text)files
Post by: deute on December 20, 2011, 09:45:18 AM
Hi guys,
I want a plugin to create a file (in the same directory) or if it allready exists to change it.
Think these are the functions i could use. But  I am not sure how to use them.
 int (*open_utf8)(const char* pathname, int flags);
 int (*open)(const char* pathname, int flags, ...);
 int (*close)(int fd);
 int (*creat)(const char *pathname, mode_t mode);
 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
 int (*read_line)(int fd, char* buffer, int buffer_size);

For example I don't know what flags I could pass to (*open). Or what is this , mode_t mode?
Maybe someone could explain at a little example to open a file and write something to it? Would be nice
Title: Re: creating/editing (text)files
Post by: nls on December 20, 2011, 01:24:33 PM
the file io stuff is (pretty close to) POSIX compliant so docs aplenty are available on the web. For example (

The best documentation is the code so either look at the functions and see what they do or perhaps easier, look at other plugins and how they use them.