[Gambas-user] ReturnValue

Doriano Blengino doriano.blengino at ...1909...
Mon Sep 7 13:28:32 CEST 2009


Dimitris Anogiatis ha scritto:
> Laurent,
>
> How can someone detect the return value from an application that's
> terminating,
> (either in gambas or bash)
>   

It depends on what we are talking about.
Under Unix (and Dos, and winslow) any program can return an integer 
value. The process sets the value, and the parent process retrieves it. 
In gambas you set the value with

	Application.Return = xxx	' <- integer value

if Charlie is not wrong.

You can test the exit code with "$?" in bash, and hProcess.Value in gambas.

But in this thread I saw you talked about file names; you can't return other data than a simple integer; if you need to return a string, or something else, you must find another way. The most easy one is to write to standard output or standard error, and read that stream from the parent process. Then one can also use some well-known file in /tmp (say, /tmp/my-program-data.tmp). There other methods too, but more complicated.

Regards,
Doriano


> Thank you in advance
>
> Regards,
> Dimitris
>
> On Mon, Sep 7, 2009 at 3:13 AM, Laurent Carlier <lordheavym at ...626...>wrote:
>
>   
>> Le lundi 07 septembre 2009 10:19:40 Charlie Reinl, vous avez écrit :
>>     
>>> Am Sonntag, den 06.09.2009, 16:10 -0600 schrieb Dimitris Anogiatis:
>>>       
>>>> hey charlie,
>>>>
>>>> Are you talking about return values on a console-type?
>>>>  I think all you have to do is use Print.
>>>>
>>>> It will also work on a gui-program if you run it through a terminal.
>>>>
>>>> I hope it helps (unless I missed something)
>>>>
>>>> Regards,
>>>> Dimitris
>>>>
>>>> On Sun, Sep 6, 2009 at 2:33 PM, Charlie Reinl <Karl.Reinl at ...9...>
>>>>         
>> wrote:
>>     
>>>>> Salut,
>>>>>
>>>>> how can I have a returned Value from a gambas-program?
>>>>> Something like a Filename.
>>>>>
>>>>> I mean a can a gambas-program which closes returns a value.
>>>>>
>>>>> --
>>>>> Charlie
>>>>>           
>>> Salut Dimitris,
>>>
>>> yes I talk about gui-program.
>>> I tried a simple RETURN <Filename> , but gambas2 had no idea to handle
>>> that.
>>>
>>> I asked for that, because I need a management for a program which stores
>>> his results in files on the disk.
>>>
>>> First I thouoght to call it with exec, so I can pass the File as
>>> argument, but I had no return if changes where made or the file saved
>>> under new name, or wich name if it is a new one.
>>>
>>> Now I will try to use the program as a component, I embed it into a form
>>> of the new management part, I can't pass the file as argu, but between
>>> NEW and Open I can pass the files name.
>>> So I will do for the return.
>>>
>>> Thanks anyway
>>> Charlie
>>>
>>>       
>> http://64.128.110.55/help/comp/gb/application/return
>>
>> Application.Return = 1
>>
>> ++
>>
>>
>> ------------------------------------------------------------------------------
>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>> trial. Simplify your report design, integration and deployment - and focus
>> on
>> what you do best, core application coding. Discover what's new with
>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>     
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with 
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>   




More information about the User mailing list