Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
let fname = "/tmp/scratch.txt"
let fptr = fopen(fname, "w")
if (fptr == nil) {
let localErrno = errno
println("Unable to open \(fname): \(strerror(localErrno))")
} else {
let text = "Hello World\n"
let bytesWritten = fwrite(text, UInt(sizeof(Byte)), strlen(text), fptr)
println("Wrote \(bytesWritten) bytes")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.