Reading from Standard In

Hi Everyone,

I hope this is the best place to discuss this — if not, please point me in
the right direction! It seems like an appropriate topic for evolution
though.

According to my limited knowledge and basic research, Swift doesn't
currently have a simple way to read from standard input from the console.
The best solution I found was this StackOverflow solution
<xcode6 - Xcode 6, Swift - read standard input (console) to string - Stack Overflow,
but it doesn't seem to be implemented on Linux yet, and I think it should
be simpler than having to use NSFileHandle if Swift is to be used as a true
systems programming language.

Of course, if there is an easier way to do this, please let me know! Or a
reason why the SO solution is the best way to do this. Thanks for reading,
would love to hear thoughts on this. I also just joined the list, so if
this has already been discussed, apologies.

-- Kyle Bashour

@kylebshr
kylebashour.com

Does the 'readline' function (introduced in Swift 2.x) work for your purposes? readLine — SwiftDoc.org

Austin

···

On Dec 6, 2015, at 9:19 PM, Kyle Bashour via swift-evolution <swift-evolution@swift.org> wrote:

Hi Everyone,

I hope this is the best place to discuss this — if not, please point me in the right direction! It seems like an appropriate topic for evolution though.

According to my limited knowledge and basic research, Swift doesn't currently have a simple way to read from standard input from the console. The best solution I found was this StackOverflow solution <xcode6 - Xcode 6, Swift - read standard input (console) to string - Stack Overflow, but it doesn't seem to be implemented on Linux yet, and I think it should be simpler than having to use NSFileHandle if Swift is to be used as a true systems programming language.

Of course, if there is an easier way to do this, please let me know! Or a reason why the SO solution is the best way to do this. Thanks for reading, would love to hear thoughts on this. I also just joined the list, so if this has already been discussed, apologies.

-- Kyle Bashour

@kylebshr
kylebashour.com <http://kylebashour.com/&gt; _______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution