是argv
字符串的 SAC 数组,还是传统的 C 字符串数组?
文档中有CommandLine.sac,但我不知道如何使用 SAC 的 API。
是argv
字符串的 SAC 数组,还是传统的 C 字符串数组?
文档中有CommandLine.sac,但我不知道如何使用 SAC 的 API。
In version (1.0) you can use the argv(1) function.
$ cat args.sac
use StdIO: all;
use Array: all;
use CommandLine: all;
int main() {
printf("Test: %s\n", argv(1));
return(0);
}
$./args hello
$ Test: hello
SAC 两者都不做(实际上更糟):SACargv()
在CommandLine
模块中提供,返回一个包含所有参数连接的字符串:
$ cat args.sac
use StdIO: all;
use Array: all;
use CommandLine: all;
int main() {
printf("%s\n", argv());
return(0);
}
$ sac2c -o args args.sac
$ ./args a b c
./args a b c