From: Per W. <pw...@ia...> - 2009-05-08 21:14:17
|
A string is just an array of characters, so you just assign characters to the array. enum { MAX_INPUT_LEN = 200, }; char my_string[MAX_INPUT_LEN]; int len = 0; int ch = 0; my_string[0] = '\0'; for (;;) { if (have_new_character()) { ch = get_next_character(); if (len < MAX_INPUT_LEN) { my_string[len++] = ch; my_string[len] = '\0'; } } } How to read from the keyboard will depend on the environment. A graphical Windows application will get events for each character. A command-line application may read from stdin. A MS-Dos application may use BIOS calls for accessing keyboard input. /pwm On Fri, 8 May 2009, frederico schardong wrote: > Some function needed a const char *name.. and how I can get char by > char by the keyboard and concatenate them to pass to this function? > > > Thanks > > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |