Get command line args

Hi,
Is there a cross platform way of getting command line args ?

I was looking in the rtl source for System.Environment.GetCommandLineArgs because I figured the .net version would use that and there doesn’t seem to be anything ?

Cheers,
John

Aside from using Main(args: array of string); as entry point, no. If you want to/can use libSilver, you can use C_ARGC/C_ARGV (from any language)

public var C_ARGC: Int
public var C_ARGV: [NativeString]

you can also (undocumented) implement

public func `$$setArgV`(_ args: NativeString[]) { }

yourself; and the compiler will generate code to call it as part of the entry point.

Thanks. Just in case your wondering I was converting some code to use begin end :slight_smile:

1 Like