* Complete a character array.
@ 2006-01-11 11:30 Ibon Castilla
2006-01-11 12:29 ` Steve Graegert
2006-01-11 18:18 ` Glynn Clements
0 siblings, 2 replies; 3+ messages in thread
From: Ibon Castilla @ 2006-01-11 11:30 UTC (permalink / raw)
To: linux-c-programming
Hi there:
This is my first message to the list. I recently started to programming in
GNU/Linux. I learned C programming with TurboC, and I'm trying to dump all
my knoweledge to Free Software :)
I've started with keyboard input functions, and here is my question: how
can I do to complete an a character array?. Both getchar() and scanf()
need the user to push ENTER. I remember getche() and getch(), but I didn't
found any similar function on any library.
Cheers, Ibon.
--
Visitame en http://sinanimodelucro.dyns.cx
Usa GNU/Linux, tus úlceras te lo agradecerán.
Realizado con Software Libre.
--
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Complete a character array.
2006-01-11 11:30 Complete a character array Ibon Castilla
@ 2006-01-11 12:29 ` Steve Graegert
2006-01-11 18:18 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: Steve Graegert @ 2006-01-11 12:29 UTC (permalink / raw)
To: linux-c-programming
On 1/11/06, Ibon Castilla <estri@euskalnet.net> wrote:
> Hi there:
>
> This is my first message to the list. I recently started to programming in
> GNU/Linux. I learned C programming with TurboC, and I'm trying to dump all
> my knoweledge to Free Software :)
>
> I've started with keyboard input functions, and here is my question: how
> can I do to complete an a character array?. Both getchar() and scanf()
> need the user to push ENTER. I remember getche() and getch(), but I didn't
> found any similar function on any library.
As far as I know, there is no such thing, but you can write one
yourself as suggested in http://c-faq.com/osdep/cbreak.html.
Unfortunately, the approach described therein is not portable, thus
requiring some effort to ease maintainability across platforms.
\Steve
--
Steve Graegert <graegerts@gmail.com>
Software Consultant {C/C++ && Java && .NET}
Office: +49 9131 7123988
Mobile: +49 1520 9289212
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Complete a character array.
2006-01-11 11:30 Complete a character array Ibon Castilla
2006-01-11 12:29 ` Steve Graegert
@ 2006-01-11 18:18 ` Glynn Clements
1 sibling, 0 replies; 3+ messages in thread
From: Glynn Clements @ 2006-01-11 18:18 UTC (permalink / raw)
To: Ibon Castilla; +Cc: linux-c-programming
Ibon Castilla wrote:
> I've started with keyboard input functions, and here is my question: how
> can I do to complete an a character array?. Both getchar() and scanf()
> need the user to push ENTER. I remember getche() and getch(), but I didn't
> found any similar function on any library.
If the kernel's terminal driver is in "canonical mode", it doesn't
pass input to the application until you press return. This is so that
it can implement line editing (backspace, Ctrl-W, Ctrl-U).
If you want to read each character as it is typed, you need to disable
canonical mode with tcsetattr().
If you are writing an interactive application, you may want to use the
curses library, which does a lot of the work involved in terminal
handling for you.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-01-11 18:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-11 11:30 Complete a character array Ibon Castilla
2006-01-11 12:29 ` Steve Graegert
2006-01-11 18:18 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).