FUNCTION  getstring()  -  Get a string from the user, using a window

  char *getstring(screen, title, def_string)
	  struct Screen *screen;
	  char *title;
	  char *def_string;

    This function will pop open a window to prompt the user for a string.
The window has o.k. and cancel gadgets, and in addition, a Close gadget.
The string you wish to get should be less than 256 characters (the default
buffer size).

    The screen argument is a pointer to a screen on which to open the
new window.  The screen argument can be NULL in which case the window will
simply appear on the Workbench screen.	The title argument will be the
title of the new window.   The def_string argument is a pointer to the
default string that will appear in the string gadget.

    This function will return NULL if the user clicks the Close Gadget or
clicks the cancel gadget.  If they click the "OK" gadget or press return in
the string gadget, you will get a pointer to a string back.  The string is
dynamically allocated and you must free it when you are done with a call to
FreeMem() (see below).

     Here is an example that gets back the users name and prints it in the
     CLI window.  In this example, the window will appear on workbench,
     have a window title "Please enter your name", and there will be no
     default string.

     char *string;

     string = getstring(NULL, "Please enter your name", NULL);

     if (string == NULL)
       printf("User does not have a name.\n");
     else {
       printf("Your name is %s.\n", string);

       /* for this example we are done with the string, so we will free
	* it now.
	*		!!!!!! **  NOTICE  ** !!!!!!
	*   You should be very careful to make sure that you free the
	* proper amount of memory using the following style call.
	* The size you MUST free is the length of the string + 1.
	* This is VERY IMPORTANT as otherwise you mess up memory.
	*/
       FreeMem(string, strlen(string)+1);
     }				/*  ^^^^ The +1 is _very_ important! */


    Again, if you want this window to appear on a custom screen (opened by
a call to makescreen() or similar) you should pass it the screen pointer
instead of NULL as the first argument.

    You should also check to make sure you didn't get back an empty string.



TODO : Probably should (again) make this into a higher level routine with
       lower level support routines.  For now this works however.

BUGS : None to the best of my knowledge.

SEE ALSO : getyn(); makewindow()

