In .NET, a file can be written to the file system using:
FileStream fs = File.Create(@"Filename");
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("Hello, World!");
// etc...
sw.Close();
fs.Close();
How would I achieve the same operation in Objective-C and Cocoa? I believe it involves the NSMutableData class, but I do not know how to implement it.
Tiny Mac Tutorials has a post on this.
The example code from that post is below: