Thread: readline

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Posts
    0
    Rep Power
    0

    readline


    how do you use readline. it is not documented very well.
    can someone show some sample code using readline to
    take in a command line.






    Thanks,
    Jonathan Donaghe
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jul 2001
    Location
    Oslo
    Posts
    1,516
    Rep Power
    15
    Have you checked out the man page? It's pretty extensive. Anyway; this is probably all you need to use it:
    Code:
    SYNOPSIS
           #include <stdio.h>
           #include <readline/readline.h>
           #include <readline/history.h>
    
           char *readline (prompt)
           char *prompt;
    
    COPYRIGHT
           Readline  is Copyright (C) 1989, 1991, 1993, 1995, 1996 by
           the Free Software Foundation, Inc.
    
    DESCRIPTION
           readline will read a line from the terminal and return it,
           using prompt as a prompt.  If prompt is null, no prompt is
           issued.  The line returned is allocated with malloc(3), so
           the  caller must free it when finished.  The line returned
           has the final newline removed, so only  the  text  of  the
           line remains.
    I just found this by searching for "Readline documentation" using Google: http://cnswww.cns.cwru.edu/~chet/readline/readline.html
    --
    Regards
    André Nćss

    Puritanism: The haunting fear that someone, somewhere may be having fun

IMN logo majestic logo threadwatch logo seochat tools logo