I have the following code. When ioctl returns an error: "the global variable errno is set appropriately." How do I handle this?
proc setSlaveAddress* (busHandle: File, slaveAddr: int) =
## Set up the i2c bus to connect to a specific client
if ioctl(busHandle, uint(slaveAddr), 0x0) != 0:
echo readChar(stderr)
raise newException(IOError, "Failed to set slave address: '" & $slaveAddr & "' error code NUMBER")
#end
#end