Closed vb4life closed 9 years ago
func (p *pin) Get() bool { bytes := make([]byte, 1) _, p.err = p.valueFile.Read(bytes) return bytes[0] != 0 }
..should be...
func (p *pin) Get() bool { bytes := make([]byte, 1) _, p.err = p.valueFile.ReadAt(bytes, 0) return bytes[0] != 0 }
The read must be from the start of the file...
Oh, and the result is the ASCII character "1" or "0", which means that the line return bytes[0] != 0 should be return bytes[0] != 48
return bytes[0] != 0
return bytes[0] != 48
..should be...
The read must be from the start of the file...