1. Exiting from a program

I just downloaded and installed Euphoria on my Linux box,
and I've written my first program -- a factorial function. 
In my source file, printfact.exu, I have the function
definition, followed by "? factorial (5)". When I enter the
shell command "exu printfact.exu", the answer, 120, is
printed, but then exu enters an interactive mode, printing
out "Press Enter...". I just want it to print the answer and
exit (back to the shell). How do I do this?

Thanks,
Tom Dailey

new topic     » topic index » view message » categorize

2. Re: Exiting from a program

I don't use Linux and it doesn't happen on a Windows XP machine, but try;

abort(0) -- Returning Successful Completion


Alex

new topic     » goto parent     » topic index » view message » categorize

3. Re: Exiting from a program

Thank you for your suggestion. Unfortunately, adding
"abort(0)" as the final line of the program has no
apparent effect.

Tom Dailey

new topic     » goto parent     » topic index » view message » categorize

4. Re: Exiting from a program

Is it warning you at all?

If so, add: }}}
<eucode>without warning</eucode>
{{{


Otherwise, you may have to wait for a Linux guru to come online!

Alex

new topic     » goto parent     » topic index » view message » categorize

5. Re: Exiting from a program

Alex:

I added "without warning" at the beginning of my source
file, but that had no effect. I guess you're right about
having to wait for an experienced Linux user...

Thanks anyway,
Tom

new topic     » goto parent     » topic index » view message » categorize

6. Re: Exiting from a program

Hi

Its not a linux thing, I think its just free_console() at the end of the
program.

Chris 

http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

7. Re: Exiting from a program

Chris:

Yes, free_console() caused the program to exit. Unfortunately,
it also erased all traces of my printout. This can't be that
hard! I just want to write a program that prints a result on
the standard output (my Xterm), and then terminates. In
other words, I want to achieve the same effect as if I had
executed a C program in which main() executes printf() and
then exit(). Surely this is possible.

Tom

new topic     » goto parent     » topic index » view message » categorize

8. Re: Exiting from a program

Tom Dailey wrote:
> 
> Chris:
> 
> Yes, free_console() caused the program to exit. Unfortunately,
> it also erased all traces of my printout. This can't be that
> hard! I just want to write a program that prints a result on
> the standard output (my Xterm), and then terminates. In
> other words, I want to achieve the same effect as if I had
> executed a C program in which main() executes printf() and
> then exit(). Surely this is possible.

Nope. The Linux version of Euphoria uses ncurses to do all writing to the screen
so you can't have normal command line programs.


The Euphoria Standard Library project :
    http://esl.sourceforge.net/
The Euphoria Standard Library mailing list :
    https://lists.sourceforge.net/lists/listinfo/esl-discussion

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu