"Go disk available space"의 두 판 사이의 차이

잔글 (Jmnote님이 Go disk free space 문서를 Go disk available space 문서로 이동했습니다)
2번째 줄: 2번째 줄:
{{DISPLAYTITLE:Go disk_free_space}}
{{DISPLAYTITLE:Go disk_free_space}}
;Go disk_free_space
;Go disk_free_space
;Go disk_avail_space
;Go disk_available_space


<syntaxhighlight lang='go' run>
<syntaxhighlight lang='go' run>

2023년 2월 26일 (일) 17:31 판

1 Go

Go disk_free_space
Go disk_avail_space
Go disk_available_space
package main

import (
	"fmt"
	"os"

	"golang.org/x/sys/unix"
)

func main() {
	var stat unix.Statfs_t
	wd, _ := os.Getwd()
	unix.Statfs(wd, &stat)
	fmt.Println(stat.Bfree * uint64(stat.Bsize))
	fmt.Println(stat.Bavail * uint64(stat.Bsize)) // ★
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}