```go
package main
import (
"flag"
"fmt"
)
var infile *string = flag.String("i", "infile", "File contains values for sorting")
var outfile *string = flag.String("o", "outfile", "File to receive sorted values")
var algorithm *string = flag.String("a", "qsort", "Sort algorithm")
func main() {
flag.Parse()
if infile != nil {
fmt.Println("infile = ", *infile, "outfile =", *outfile, "algorithm =", *algorithm)
}
}
```
[ `go run` | done: ]
Failed to construct ipc body: Encode Error: 'utf8' codec can't decode bytes in position 14-15: invalid data
我刚开始学,还不懂
代码不完整吧,建议放在 play.golang.org,然后共享一下连接。infile, outfile 应该时 *string 类型吧, 写错了?
#1
更多评论
我运行代码没问题。 <a href="/user/ckrissun" title="@ckrissun">@ckrissun</a> play.golang.org 要翻墙,可能不是太方便,可以使用 http://studygolang.com/wide/playground 或 https://wide.b3log.org/playground/1420c5a793665f54a0fe7bcdf9f37e31.go
#2