[swift-users] Pure Swift, cross platform way to open, read/write files?

Greg Skluzacek swftcdnnj at gmail.com
Mon Dec 7 21:47:39 CST 2015


Hi new to Swift and I am really excited that Apple has open sourced it! I
use macs at home an Linux at work, so now I may actually be able to develop
in one language on both platforms (and not use Java).

That being said, is there a way open a file for either reading line by line
and writing line by line that is done purely in Swift and is cross platform.

I did go through the Getting Started page and saw that one was able to
import Glibc on Linux which implements the C fopen, etc., but when I tried
to import it in the REPL on OS X, I got the error:

repl.swift:1:8: error: no such module 'Glibc'

import Glibc

       ^

swift --version returns:

Chateau-Louise:/ gskluzacek$ swift --version

Apple Swift version 2.1 (swiftlang-700.1.101.6 clang-700.1.76)

Target: x86_64-apple-darwin14.5.0

Chateau-Louise:/ gskluzacek$

Thanks,
-- Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151207/e893521d/attachment.html>


More information about the swift-users mailing list