Last active
December 25, 2020 13:51
-
-
Save pebble8888/70bfce115c06c34cb7d4d8e623a71a7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if let stream:InputStream = InputStream(fileAtPath: "/Users/pebble8888/hoge.txt") { | |
var buf:[UInt8] = [UInt8](repeating: 0, count: 16) | |
stream.open() | |
while true { | |
let len = stream.read(&buf, maxLength: buf.count) | |
print("len \(len)") | |
for i in 0..<len { | |
print(String(format:"%02x ", buf[i]), terminator: "") | |
} | |
if len < buf.count { | |
break | |
} | |
} | |
stream.close() | |
} |
Hello,
I 've trying to write the exact same read data to another file but without any success yet.
Would you mind sharing some code for that too?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful. Thanks