-
-
Save iezer/232cc7449dc6f573201fe9ed7b1f9a43 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
import Foundation | |
func getln() -> String { | |
let stdin = NSFileHandle.fileHandleWithStandardInput() | |
var input = NSString(data: stdin.availableData, encoding: NSUTF8StringEncoding) | |
input = input!.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet()) | |
return input as! String | |
} | |
print("Hello, what's your name?") | |
let input = getln() | |
print(input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment