package main
import (
"fmt"
"io/ioutil"
)
func main() {
// Just count the files...
systems,_ := ioutil.ReadDir("./XML")
fmt.Printf("# of planetary systems\t%d\r\n", len(systems))
// For each datafile
for _,element := range systems {
fmt.Println(element.Name)
}
}
这条线...
fmt.Println(element.Name)
正在输出内存地址而不是我假设的文件名字符串。为什么?我如何获得实际的字符串?谢谢。
此外,所有地址都相同,我希望它们有所不同,这意味着我的 for-each 循环可能会被破坏
慕无忌1623718
相关分类