How to access the program name / argv [0] in Forth?

Gforth's documentation is said to access arguments by calling next-arg , but that does not mean the name of the program to be printed in C- as a language.

Since argv[0] seems to be automatically removed from the argument vector in Forth, is there a special function that I can call that returns it?

+4
source share
2 answers

sourcefilename gives the name of the program, and n arg receives the arguments sent to gforth, including the binary name gforth.

+6
source

0 arg will always return argv[0] , and the rest of the arg list changes to next-arg . sourcefilename is the name of the file you just upload.

0
source

Source: https://habr.com/ru/post/1438160/


All Articles