Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c05/c05_04 #32

Open
utterances-bot opened this issue Apr 18, 2022 · 3 comments
Open

c05/c05_04 #32

utterances-bot opened this issue Apr 18, 2022 · 3 comments

Comments

@utterances-bot
Copy link

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

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

Copy link

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

@iswbm
Copy link
Owner

iswbm commented Jun 11, 2022

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

感谢,已更新代码

Copy link

isFxh commented Sep 20, 2022

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

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants