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

How to writeFile??? #61

Open
Hodoio opened this issue Oct 21, 2022 · 0 comments
Open

How to writeFile??? #61

Hodoio opened this issue Oct 21, 2022 · 0 comments

Comments

@Hodoio
Copy link

Hodoio commented Oct 21, 2022

func WriteByString(path string, data string) bool {
	fileFlock := flock.New(path)
	if err := fileFlock.RLock(); err != nil {
		return false
	}
	file, err := os.Open(path)
	if err != nil {
		return false
	}
	if _, err := io.WriteString(file, data); err != nil {
		fmt.Println(err.Error())
		return false
	}
	return true
}

error:

write ./set.txt: Access is denied.
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

1 participant