The difference between SysArgv and AppArguments() from stdlibcore.ring

32 views
Skip to first unread message

Mahmoud Fayed

unread,
Dec 3, 2025, 4:55:07 PM (5 days ago) Dec 3
to The Ring Programming Language
Hello

When creating command line utilities that accept arguments from the user through the terminal, we have two options

(1) Using: SysArgv (global variable)
(2) Using AppArguments() function from stdlibcore.ring

It's always recommended to use AppArguments() to avoid the executable name and script file name which are stored in SysArgv

Example:
Program Name: apparg.ring

load "stdlibcore.ring"

? sysargv
? "******"
? apparguments()
? "******"

Test (1): ring apparg.ring para1 para2

Output:

ring
apparg.ring
para1
para2

******
para1
para2

******

Using appArguments() we just get (para1) and (para2), i.e. what we care about

Test(2):
ring2exe apparg.ring -static
apparg para1 para2

Output:

apparg
para1
para2

******
para1
para2

******

Again, using appArguments() we just get (para1) and (para2), i.e. what we care about

Note: appArguments() is written by  Mounir IDRASSI 

Greetings,
Mahmoud

Azzeddine Remmal

unread,
Dec 3, 2025, 8:37:34 PM (4 days ago) Dec 3
to The Ring Programming Language
Hello Mahmoud

Thank you for sharing

Best regards, azzeddine

Mahmoud Fayed

unread,
Dec 3, 2025, 8:46:48 PM (4 days ago) Dec 3
to The Ring Programming Language
Hello Azzeddine

You are welcome :D

Greetings,
Mahmoud

Reply all
Reply to author
Forward
0 new messages