Logo

Programming-Idioms

History of Idiom 199 > diff from v5 to v6

Edit summary for version 6 by 花大喵:
New Go implementation by user [花大喵]

Version 5

2019-11-05, 20:55:23

Version 6

2020-12-08, 09:59:49

Idiom #199 Truncate a file at the current file position

Truncate a file F at the give file position.

Idiom #199 Truncate a file at the current file position

Truncate a file F at the give file position.

Variables
F
Imports
os
Code
func truncateFile(filePath string, position int64) {
	
	err := os.Truncate(filePath, position)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println("succeed to truncate...")

}