sgets(3f) - [ARGUMENTS:M_kracken] given keyword fetch string value parsed on whitespace into an array (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
See Also
Author
License
function sgets(name,delim) result(strings)
character(len=*),intent(in) :: name character(len=*),intent(in),optional :: delim character(len=:),allocatable :: strings(:)
The sgets(3f) function returns a dynamically allocated array of character values from a string that is the value for a command line option. It is part of the M_kracken(3fm) module.
name the dictionary keyword (in form VERB_KEYWORD) to retrieve. The VERB name comes from the first argument of the KRACKEN(3f) or DISSECT(3f) call. The KEYWORD is a keyword from the second argument to the KRACKEN(3f) or DISSECT(3f) call. This routine trusts that the desired name exists. If the name does not exist the array [char(0)] is returned. An array of zero size is returned if the string is blank. delim characters to split the string at into elements
strings returned string array
Sample program:
program demo_sgets use M_kracken, only : kracken, sgets implicit none character(len=:),allocatable :: strings(:) integer :: i call kracken(cmd, -string This is a sentence ) strings= sgets("cmd_string") ! get -strings words print *, "string=",([//trim(strings(i))//],i=1,size(strings)) print *, "len= ",len(strings) print *, "size=",size(strings) end program demo_sgetsExample program execution:
$ demo_sgets string=[This][is][a][sentence] len= 8 size= 4$ demo_sgets -string a b c d e f g string=[a][b][c][d][e][f][g] len= 1 size= 7
dget(3f), dgets(3f), iget(3f), igets(3f), lget(3f), lgets(3f), rget(3f), rgets(3f), sget(3f), retrev(3f)
M_kracken(3f), kracken(3f) parse(3f), dissect(3f), store(3f), setprompts(3f), show(3f)
John S. Urban
Public Domain
Nemo Release 3.1 | sgets (3) | February 23, 2025 |