Created
August 24, 2016 08:05
-
-
Save stansidel/b106c49c4410b57bd75ec85845390382 to your computer and use it in GitHub Desktop.
Reading input and writing to stderr in Swift (for programming challenges)
This file contains hidden or 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
import Foundation | |
public struct StderrOutputStream: OutputStreamType { | |
public mutating func write(string: String) { fputs(string, stderr) } | |
} | |
public var errStream = StderrOutputStream() | |
let T = Int(readLine()!)! | |
debugPrint("T = \(T)", toStream: &errStream) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment