How do I get the output of a UNIX command to populate a list box in AF
or show in a text box?
I know how to write a dataset from a piped fileref.
This is from an example:
pipe:
/* Create the dataset work.kshusers with the uid
variable. */
dsid=open('kshusers', 'n');
rc=newvar(dsid, 'uid', 'c', 20);
rc=close(dsid);
/* Open the dataset in update mode so we can use the
append function. */
dsid=open('kshusers', 'u');
call set(dsid);
/* Assign our UNIX command to a fileref. */
command='grep "ksh$" /etc/passwd | sed "s/:.*$//"';
rc=filename('comfref', command, 'PIPE');
fid=fopen('comfref', 'S');
/* Read the output from the pipe. */
do while(fread(fid) ^= -1);
rc=fget(fid,uid);
rc=append(dsid);
end;
/* Clean up. */
rc=close(dsid);
rc=fclose(fid);
rc=filename('comfref', ' ');
return;
How do I directly read that into an SCL list or text box instead?