How do I write to a txt file, so I would like a string value inside the document which I later want to read.
What I want to do is basically just a demo app, I want a specific piece of text in a NSTextField to be written into a file and then be read from the file and the contents of the file to be placed in a second NSTextField.
You can use NSString's -writeToFile:atomically:encoding:error: or -writeToURL:atomically:encoding:error: methods to write your string to a file. There are plenty of other ways, but these are about as easy as it gets. There are corresponding methods for reading a file into a string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With