123456789101112131415161718192021222324 |
- //go:build windows && (amd64 || arm64 || ppc64 || ppc64le || s390x || mips64 || mips64le)
- package yu_file
- import yu_sys "gogs.qqck.cn/s/tools/sys"
- // Write
- //
- // @Description: (非多线程安全)写出文件
- // @param name 文件路径
- // @param bufs 写出内容...
- func Write(name string, bufs ...[]byte) bool {
- j_fd, _, _ := yu_sys.CreateFileW.Call(yu_sys.S{yu_sys.Unicode, name}, yu_sys.GENERIC_WRITE, yu_sys.FILE_SHARE_NO, 0, yu_sys.CREATE_ALWAYS, yu_sys.FILE_FLAG_WRITE_THROUGH, 0)
- if int64(j_fd) == -1 {
- return false
- }
- defer yu_sys.CloseHandle.Call(j_fd)
- for j_i := 0; j_i < len(bufs); j_i++ {
- if !writeFile(j_fd, bufs[j_i]) {
- return false
- }
- }
- return true
- }
|