mirror of
https://github.com/tjboldt/ProDOS-Utilities.git
synced 2024-11-24 16:31:28 +00:00
23 lines
393 B
Go
23 lines
393 B
Go
package prodos
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
func ReadBlock(file *os.File, block int) []byte {
|
|
buffer := make([]byte, 512)
|
|
|
|
file.ReadAt(buffer, int64(block)*512)
|
|
|
|
return buffer
|
|
}
|
|
|
|
func WriteBlock(file *os.File, block int, buffer []byte) {
|
|
WriteBlockNoSync(file, block, buffer)
|
|
file.Sync()
|
|
}
|
|
|
|
func WriteBlockNoSync(file *os.File, block int, buffer []byte) {
|
|
file.WriteAt(buffer, int64(block)*512)
|
|
}
|