GolangCodingTime icon indicating copy to clipboard operation
GolangCodingTime copied to clipboard

c05/c05_04

Open utterances-bot opened this issue 2 years ago • 3 comments

5.4 总结 Go 读文件的 10 种方法 — Go编程时光 1.0.0 documentation

https://golang.iswbm.com/c05/c05_04.html

utterances-bot avatar Apr 18 '22 02:04 utterances-bot

3.2 使用 syscall 库 这里面 第一个协程, wg.Done() 前面是不是少了defer

Terencesun avatar Apr 18 '22 02:04 Terencesun

3.2 使用 syscall 库 这里面 第一个协程, wg.Done() 前面是不是少了defer

感谢,已更新代码

iswbm avatar Jun 11 '22 07:06 iswbm

syscall.Read读取文件的时候,我设定一次读取数据的buffer大小为1024字节,读出来之后会有多余的字节显示出来啊

data := make([]byte, 1024)
offset, _ := syscall.Read(fd, data)
if offset == 0 {
    break
}

展示出来的会有多余的空字节

哪位大佬帮忙解答一下,问题出在哪里了呀🙏

isFxh avatar Sep 20 '22 06:09 isFxh