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: Bernd Paysan
Subject: Re: [gforth] How do I access the program name / argv[0] in Forth?
Date: Thu, 11 Oct 2012 13:27:59 +0200
User-agent: KMail/4.8.5 (Linux/3.4.6-2.10-desktop; KDE/4.8.5; x86_64; ; )

Am Donnerstag, 11. Oktober 2012, 12:16:29 schrieb Bernd Paysan:
> Andrew Pennebaker <address@hidden> schrieb:
> >> Ah, the name of the current source file is always 'sourcefilename'.
> >
> >No
> >
> >> matter
> >> where in the command line it is - or if it is a command line at all.
> >
> >That's weird, on my computer, sourcefilename doesn't return the
> >filename at
> >all. It returns the number 13:
> >
> >Code:
> >
> >https://github.com/mcandre/scriptname/blob/master/scriptname.fs
> >
> >Trace:
> >
> >$ ./scriptname.fs
> >Program: 13
> 
> It's an addr len string. Try type instead.

To avoid any misunderstandings:

sourcefilename type

will print the source file name.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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