Rockbox Development > Starting Development and Compiling
Error making a menu?
saratoga:
See firmware\target\arm\sandisk\sansa-c200\button-c200.c
motionman95:
Thanks!!! I cannot express how thankful I am for all the help and gratitude. I only have one last question: How do I add a string and an integer together? The following isn't working:
--- Quote ---int how_old = 20;
char name = "John Jameson";
char final_string = "";
final_string = name + " is " + how_old;
--- End quote ---
saratoga:
The + operator in c literally just does addition. You can't use it for concatenation or formatting like in other languages. Instead, you'll need sprintf:
http://www.cplusplus.com/reference/clibrary/cstdio/sprintf.html
You may also be interested in the functions in string.h.
motionman95:
Once again, I cannot express my thankfulness. I'm trying to use the virtual keyboard, and nls post (on a different thread) was very helpful. The only problem is, I can't get it to work.
What nls posted:
--- Quote ---You just need to call rb->kbd_input() where the first argument is a char* to a buffer and the second is the length of the buffer.
see apps/recorder/keyboard.c and apps/keyboard.h
--- End quote ---
What I tried:
--- Quote ---text = rb->kbd_input(char, buffer_length);
--- End quote ---
Where can I get the values that char and buffer_length are supposed to have?
nls:
This is something that is done in several places in rockbox code, so you can find out how these things work by looking around.
This is how you would usually do it:
--- Code: ---char buf[100];
rb->kbd_input(buf, sizeof (buf));
--- End code ---
the text entered in the keyboard will end up in buf, 100 is the length of that buffer, and sizeof is just used to avoid
issues if that number is changed in the future but could be replaced by 100 if you like.
the return code for the function is either -1 (user aborted) or 0 (success).
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version