1 Star 0 Fork 0

wukai/GoStudy

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fileinput.go 368 Bytes
一键复制 编辑 原始数据 按行查看 历史
君町love 提交于 2019-01-15 23:23 +08:00 . file operation
package datarw
import (
"bufio"
"fmt"
"io"
"os"
)
func ReadFile() {
file, err := os.Open("input.txt")
if err != nil {
fmt.Println(err)
return
}
defer file.Close()
reader := bufio.NewReader(file)
for {
inputString, readerError := reader.ReadString('\n')
fmt.Printf("The input was: %s", inputString)
if readerError == io.EOF {
return
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/thinkerwolf/GoStudy.git
git@gitee.com:thinkerwolf/GoStudy.git
thinkerwolf
GoStudy
GoStudy
62820d0e2c88

搜索帮助