|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Apprentice |
How do I get F-Script to read a file? For example, I have a CSV full of URLs, and I would like to create URL references for each of them.
The examples in the developer kit include writing, but not reading files. |
||
|
|
Apprentice |
You read a file just like you would with Cocoa: use NSString stringWithContentsOfFile: pathToFile encoding:NSStringEncoding error:NSError.
data := NSString stringWithContentsOfFile:'/Users/username/Desktop/test.csv' encoding:NSUTF8StringEncoding error:nil. This returns a NSString containing the contents of the CSV file. To parse the CSV file, you can use -componentsSeparatedByString:NSString dataItems := data componentsSeparatedByString:', '. This returns a NSArray of each comma separated value. |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|

