Rockbox Development > Starting Development and Compiling
Reading files?
motionman95:
How do I read files? I keep trying with this:
--- Code: ---textfile_text = rb->read("ABC.config");
--- End code ---
But it isn't working. What am I doing wrong?
Llorean:
Seriously. At this point it'd be really beneficial to you to stop, take two or three weeks to work through a thorough set of lessons to learn the fundamentals of C, then another week or two of just reading the Rockbox source, learning its structure, and learning how to search for function definitions and etc within it.
The questions you've been asking basically seem to suggest that you're just trying to guess your way through this. The purpose of our forums isn't to teach you how to program. This section is primarily for questions on how to get started compiling. It's expected that you'll have a basic knowledge of programming. At the very least, you should check out other parts of the code, see what they're doing, etc.
bluebrother:
--- Quote from: motionman95 on March 10, 2009, 04:28:54 PM ---
--- Code: ---textfile_text = rb->read("ABC.config");
--- End code ---
But it isn't working. What am I doing wrong?
--- End quote ---
The prototype for read() is completely different:
--- Code: ---ssize_t read(int fd, void *buf, size_t count);
--- End code ---
Plus, it doesn't look like you have opened the file or have a file descriptor yet.
motionman95:
--- Quote from: Llorean on March 10, 2009, 06:01:54 PM ---The questions you've been asking basically seem to suggest that you're just trying to guess your way through this.
--- End quote ---
Which is absolutely not the case. I know 6 languages:
CSS,
HTML,
XML,
Actionscript,
Javascript,
and AutoIt.
The closet language to C is javascript, and actionscript. I not guessing, it's just that I think rockbox would have a lot more developers if they wrote some documentation. Not that I haven't manged without it, but still, it would help. I'll admit that I was lazy in this instance, and had only about 10 minutes to work on it. (I'm a very busy guy.)
Llorean:
Knowing 6 languages, of which two are loosely like C in syntax, doesn't mean you aren't guessing.
The statement you tried in the first post in this thread was a guess. When you tried to add two strings together with a +, it was a guess. When you tried to use included functions like rb->kbd_input() you just guessed instead of looking at how they were used elsewhere and were told to look around the source afterward, which means it's surprising to me that you chose not to this time. Knowing more about C and its differences from the languages you know (which are significant) will help you a lot, as well as actually looking at how the functions are used elsewhere in the code.
As bluebrother mentioned, the prototype for the function you tried to use is completely different. A basic knowledge of C would've had you at least know what parameters were expected of the function.
Navigation
[0] Message Index
[#] Next page
Go to full version