Editable input? 
Author Message
 Editable input?

Just found this newsgroup, and just started writing some C code after a lotta
 years.

So for practice I started to write a small address base, and discovered that
things don't work like I remembered!  I want to get data from the keyboard...
so there's getc, gets, and then there's scanf.  I want to work directly with
the incoming data, so I selected gets, and then discovered that, unlike I
remembered it, it doesn't trap backspace (^h), but handles it like ordinary data.  

I'm running this on Linux and compiling with gcc, both (all?) of which I'm
just getting familiar with as well.  What simple keyboard input command traps
the backspace and allows the edition of data being input?  Or what stupid
newbie stunt am I pulling now..<grin>?

Thanks in advance,

Bill Tallman



Sat, 19 Jul 2003 17:14:39 GMT  
 Editable input?

Quote:
> Just found this newsgroup, and just started writing some C code after a lotta
>  years.

> So for practice I started to write a small address base, and discovered that
> things don't work like I remembered!  I want to get data from the keyboard...
> so there's getc, gets, and then there's scanf.

You really should discard gets() from the above list but replace
it with fgets().

(read the faq of this newsgroup at:
http://www.eskimo.com/~scs/C-faq/top.html)

scanf() also isn't the function beginners should be confronted
with.

Quote:
> I want to work directly with
> the incoming data, so I selected gets, and then discovered that, unlike I
> remembered it, it doesn't trap backspace (^h), but handles it like ordinary data.  

> I'm running this on Linux and compiling with gcc, both (all?) of which I'm
> just getting familiar with as well.  What simple keyboard input command traps
> the backspace and allows the edition of data being input?  Or what stupid
> newbie stunt am I pulling now..<grin>?

You should learn about how I/O is buffered in the standard
library. The keyboard driver or terminal driver is left to
the implementation which is the linux box in your case.
Now this becomes way offtopic for this newsgroup, so I should
point you to an other place. Take your question to:

comp.os.linux.development.apps

BTW, man is a very powerful tool for befinners! :-)

Quote:
> Thanks in advance,

> Bill Tallman

You're wellcome.

--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond



Sat, 19 Jul 2003 17:39:32 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Combobox - changing between editable and non-editable

2. input, output, input/output parameters?????

3. ListView Items: Can they be Editable?

4. Parent-Child Editable Grid Example?

5. Editable Text Fields

6. making cells in Datagrid Non-Editable...

7. Problem with Creating an Editable ComboBox

8. ListView becomes editable

9. Adding a constructor for a given (non editable) class

10. editable console prompt

11. How to set combobox editable?

12. ListView becomes editable

 

 
Powered by phpBB® Forum Software