Rockbox Development > Starting Development and Compiling

creating/editing (text)files

(1/1)

deute:
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

nls:
the file io stuff is (pretty close to) POSIX compliant so docs aplenty are available on the web. For example http://linux.die.net/man/2/open

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.

Navigation

[0] Message Index

Go to full version