C programming help

andrew clarke mail at ozzmosis.com
Sun Apr 18 22:50:38 UTC 2010


On Sun 2010-04-18 16:39:40 UTC-0600, Karl Larsen (klarsen1 at gmail.com) wrote:

> On 04/18/2010 04:28 PM, andrew clarke wrote:
> > On Sun 2010-04-18 15:54:09 UTC-0600, Karl Larsen (klarsen1 at gmail.com) wrote:
> >>> On Sun 2010-04-18 14:29:16 UTC+0200, Ugur Arpaci (ugurarpaci at gmail.com) wrote:
> >    
> >>>> The problem is; i must make those changing on Terminal by moving cursor
> >>>> left and right by arrow keys.
> >>
> >>          Here is a general string using c code from The New C Primer
> >> Plus, Second Edition SAMS Publishing. This is the example strings.c
> >> shown on page 360 which I had to correct several errors in. But this
> >> works fine.
> >>
> >> It is attached to this message. I hope it makes it.
> >      
> > It made it but is irrelevant to the OP's question, due to the cursor
> > key movement requirement.
> >
> > I don't think you read the OP's original question, or did not
> > understand it.
> >
> > Incidentally gets() is dangerous and should NEVER be used because of
> > lack of bounds checking.
>
>      That is never mentioned in my book. I wonder why? I saw he was 
> trying to handle strings and this shows a few ways. If he wants 
> something to happen when he moves his cursor left and right I do not 
> know how to sense that. But sure there must be some standard C that will 
> sense the cursor.

There are a lot of very average C books out there.  Security is still
often seen as an afterthought.  THis is partly why so many
badly-written programs exist.

You are giving standard C too much credit.  The language was designed
primarily in the early 1970s and predates video displays.  Most
computers were still using printers for output.  Consequently standard
C has no concept of cursors.  The relatively modern Readline, Curses
and S-Lang libraries do, though.




More information about the ubuntu-users mailing list