     }
 
     public func readString() -> String? {
-        var buf = readData()
+        var buf = readChars()
         if buf == nil {
             return nil
         }

        return String(cString: &buf!)
    }

    public func readData() -> [CChar]? {
        var buf = [CChar](repeating:0, count: 4096) //4096 chars at max in canonical mode

        let n = read(fd, &buf, buf.count * MemoryLayout<CChar>.stride)

#else
    import Darwin.C
#endif

import Foundation

extension SwiftyGPIO {

