Create Write function edit proposal

using the .write function and I noticed that the output decoding of the string is probably wrong,e.g 129 in input is decoded 215 in output, so was an unsigned to signed decoding problem, solved it casting in a int type and after in a byte type. Check it!