0 Members and 3 Guests are viewing this topic.
This code crashes :Code: [Select]int main(){ char *filename; if(show_msg_user_input("A", "B", "C", &filename) != -1) free(filename); return 0;}
int main(){ char *filename; if(show_msg_user_input("A", "B", "C", &filename) != -1) free(filename); return 0;}
And I can't find any libndls directory in /ndless/ ... (I use the Ndl3ss SDK)
const char * title = "Title"; const char * msg = "Element"; char * defaultvalue = "default value"; char * value; unsigned len = show_msg_user_input(title, msg, defaultvalue, &value); if (len >= 0) { printf("%s (%d)\n", value, len); free(value); } else puts("Canceled");
EDIT : second question on the go : why does libndls's refresh_osscr() crashes ?
Quote from: Levak on January 21, 2013, 10:19:18 amIndeed, you don't know its size and putting arbitrary size (here 256) is a bad programming behavior.I don't want to be a nitpicker, but I have to disagree. In a practical context, using "big enough" buffers when dealing with arbitrary-sized strings is in many cases better than hassling around with a bunch of pointers and dynamically allocated memory. Using the latter method complexifies and bloats the code unnecessarily, gives the programmer additional responsibility (gotta compute the size of the data, malloc it, remember to free the memory, etc.), decreases the programs maintainability (as the code for that filename container is scattered around, when modifying bigger chunks better check it doesn't cause any undefined behavior), and generally the whatever academic perfection of the code doesn't outweigh the pain of dealing with such trivial stuff. We're not talking about security-critical government-class programs here, and it's not like there aren't any functions to avoid buffer overflows and whatnot.I'm not saying you should be using statically allocated data for everything (quite the contrary usually), but for string buffers and such, a char buf[BUF_SIZE]; is usually good enough.
Indeed, you don't know its size and putting arbitrary size (here 256) is a bad programming behavior.
I'm using nspire_emu_easy from Ti-Planet, it's a version with Ndl3ss already in it. Do you think it could be the wrong version ?
And there is a SaveAs popup ? O.o I didn't see it.
Do I need to get ndless 3.1, and should I?
Do I just download os 3.1 from tiplanet and then follow the nspire 3.1 instructions?
Is there any particular order that I should install nlaunch and ndless in?
Do I install nlaunch or nlaunchy?
Is there any way to find all user uploaded games for nspire cx ndless (and can I use games for the regular nspire ndless on the cx?)?