Link to documentation http://gambasdoc.org/help/lang/exec .
I think you should do it like;
EXEC [ ls, -la, /tmp ] FOR READ AS Contents
PUBLIC SUB Contents_Read()
DIM sLine AS String
READ #LAST, sLine, -256
sOutput = sLine
END
Jussi
On Wed, May 26, 2010 at 08:05, vikram austin...@yahoo.com wrote:
Hi,
I am new to
Gambas and this is my first application. I have been working with
C/VC++ and Gambas has been fun so far except for this little problem
i've run into...
I am trying to make a GUI front end for the
GNU shred command. I have got to the stage where the user can select a
file via GUI and shred(using SHELL). I am trying to make it more
interactive by reading stdout from shred -v into the Gambas
application. I have followed
http://www.gambasforum.com/index.php?topic=120.0;wap2 and tried to use
EXEC to read stdout, haven't had much luck with it so far :(
Heres the code:
'global variables
PRIVATE filename AS String
PRIVATE delfile AS Boolean
PRIVATE shredprocess AS Process
PRIVATE shredcommanddel AS String[3]
PRIVATE shredcommandnodel AS String[3]
'this is where i initialize the command arrays for EXEC
'the last element is replaced later by the filepath
PUBLIC SUB Form_Open()
'tbx_filename
shredcommanddel = [shred , -uv , ]
shredcommandnodel = [shred , -v , ]
END
'Display a file open dialog and save the path of the file selected to filepath
PUBLIC SUB btn_fileselect_Click()
IF Dialog.OpenFile() THEN RETURN
filename = Dialog.Path
tbx_filename.Text = filename
END
'the actual shredding happens here, the code with EXEC is ineffective at the
moment it doesnt shred the file
'SHELL works, but i dont know how to redirect stdout with either of these
PUBLIC SUB btn_shred_Click()
'DIM shellcommand AS String[]
'Message(filename)
IF delfile THEN
'shellcommand = shred --remove --verbose filename
shredcommanddel[2] = filename
shredprocess = EXEC shredcommanddel 'FOR READ
SHELL shred -uv filename
ELSE
'shellcommand = shred --verbose filename
shredcommandnodel[2] = filename
shredprocess = EXEC shredcommandnodel 'FOR READ
SHELL shred -v filename
ENDIF
'SHELL shellcommand FOR READ AS Process
END
'Execution never gets here
PUBLIC SUB Process_Read()
DIM resultline AS String
LINE INPUT #shredprocess, resultline
Message(HERE WE ARE!)
resultline = resultline GB.NewLine
END
PUBLIC SUB CheckBox1_Click()
delfile = TRUE
END
I am looking for a way to redirect output from the shred to my Gambas
application.
Appreciate your help in this.
Thanks,
Vikram
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user