Hello everyone! Now i am trying (newbie) on Ubuntu Swift 3. I am trying to Read 
String from File Using FileHandle


import Foundation
let filemgr = FileManager.default
let filepath1 = "/home/roman/test"


let file: FileHandle? = FileHandle(forReadingAtPath: filepath1)


if file == nil {
    print("File open failed")
} else {
    let databuffer = file?.readDataToEndOfFile
    let String1 = String(databuffer, encoding: String.Encoding.utf8)
    file?.closeFile()
    print(String1)
} 


But get error from compiler 

/home/roman/swift/Sources/main.swift:11:19: error: 'init' has been renamed to 
'init(describing:)'
    let String1 = String(databuffer, encoding: String.Encoding.utf8)
                  ^
Swift.String:21:12: note: 'init' has been explicitly marked unavailable here
    public init<T>(_: T)
           ^
<unknown>:0: error: build had 1 command failures
error: exit(1): 
/home/roman/swift-3.0.2-RELEASE-ubuntu16.04/usr/bin/swift-build-tool -f 
/home/roman/swift/.build/debug.yaml


Why it talking about init? when i use String


Roman Pastushkov
xnucleargemi...@aol.com


_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to