[Top][All Lists]

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

Re: [gforth] (novice) looking for example to use somevar=argv[1] ??

From: Joel Rees
Subject: Re: [gforth] (novice) looking for example to use somevar=argv[1] ??
Date: Sun, 18 Jun 2017 07:30:35 +0900

On Sun, Jun 18, 2017 at 5:47 AM, Francois Pussault
<address@hidden> wrote:
> Hello
> I don't understand the official doc page 
> so I cannot use args.
> gforth  foo.fs  5 10
> using a code like :
> 1 arg type CR
> display it  ok but as a text so I cannot affect that numbers to  variables

Shell command line arguments generally indicate many things, including
numbers. That means that, when a program looks at a command line
argument, it is looking at a text string -- a string of characters. It is up to
the program to convert that string to a number if the program wants a

Take a look and "Line input and conversion" for some clues about how to
do that:

It seems to be about converting text from the keyboard, but the same
principles should apply.

The words >number , >float , s>number? , and s>unumber? are of
particular interest.

Joel Rees

One of these days I'll get someone to pay me
to design a language that combines the best of Forth and C.
Then I'll be able to leap wide instruction sets with a single #ifdef,
run faster than a speeding infinite loop with a #define,
and stop all integer size bugs with my bare cast.

More of my delusions:

reply via email to

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