gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gforth] How do I access the program name / argv[0] in Forth?


From: Andrew Pennebaker
Subject: Re: [gforth] How do I access the program name / argv[0] in Forth?
Date: Sat, 6 Oct 2012 14:23:53 -0400


Am Samstag, 6. Oktober 2012, 13:43:23 schrieb Andrew Pennebaker:
> > `0 arg` or `argv @ @ cstring>string` both give "gforth" on my system...
>
> Ah, that's better!
>
> How could I reliably access the program name if the user decides to pass
> some options to gforth before supplying the source code file name?

Suggestion 1: With '0 arg'.
Suggestion 2: Try it.  It's Forth.  You are supposed to try thing before
asking questions.

I'm not trying to get "gforth", which Josh is getting on his system. I'm trying to access my gforth program's name (e.g. hello.fs). If 0 arg returns "gforth", what would reliably return "hello.fs"? Because if a user passed in options to gforth before the source code file name (e.g. gforth -xyz hello.fs), 1 arg would show "-xyz" instead of "hello.fs".

--
Cheers,

Andrew Pennebaker
www.yellosoft.us

reply via email to

[Prev in Thread] Current Thread [Next in Thread]