[Main]
Name=gets
Type=Function
Subtype=tigcc.a
Header Files=stdio.h
Definition=char *gets (char *string);
See Also=getsn, info/faq/68: How can I get input from the keyboard?, textedit.h/

[Library Call]
Asm=1
TIOS Callback=0

[Registers]
string=a2

[Description]
Gets a string from the keyboard.

[Explanation]
gets collects a string of characters terminated by a new line from the
keyboard (by repeated calling to <A HREF="$$LINK(getchar)">getchar</A>) and puts it into <I>string</I>.
The new line is replaced by a null character ('\0') in <I>string</I>.
gets returns when it encounters a new line (i.e. when the ENTER key is pressed); everything up
to the new line is copied into <I>string</I>. gets returns the string argument <I>string</I>
(ANSI proposes returning of <A HREF="$$LINK(alloc.h/NULL)">NULL</A> in a case of error, but this never occurs
on the TI). For editing, the backspace key is supported. Here is an example of usage:
<PRE>char buffer[50];
int a, b;
clrscr ();
puts ("A = ");
a = atoi (gets (buffer));
puts ("B = ");
b = atoi (gets (buffer));
printf ("%d + %d = %d", a, b, a+b);
</PRE>
<A HREF="$$LINK(stdlib.h/atoi)">atoi</A> is an ANSI C standard function from <A HREF="$$LINK(stdlib.h/)">stdlib.h</A>
header file.
<BR><BR>
<B>Important:</B> gets does <B>not</B> check buffer bounds, so using
<A HREF="$$LINK(getsn)">getsn</A> or a custom input routine is recommended instead.

[References]
Out=fputchar, printf, events.h/EV_captureEvents, events.h/EV_defaultHandler, graph.h/MoveTo, graph.h/SaveScrState, kbd.h/ngetchx
Out_EV_eventLoop=1
