我正在尝试在Swift 3中使用getopt处理命令行参数。我参考了Michele Dall'Agata在stackoverflow的贡献:
let pattern = "abc:"
var buffer = Array( pattern.utf8 ).map { Int8($0) }
当我使用这段代码时:
let option = Int( getopt( CommandLine.argc, CommandLine.arguments, buffer ) )
我遇到了这个错误:
我正在尝试使用CommandLine.arguments作为argv。有谁知道getopt的第二个参数的正确语法吗?提前感谢!无法将类型为 '[String]' 的值转换为预期的参数类型 'UnsafePointer<UnsafeMutablePointer<Int8>?>!'
'UnsafePointer?>!'
这一部分也要翻译吗? - Alexander