File input/output: Difference between revisions
Content added Content deleted
m (→{{header|jq}}: any number of JSON entities) |
|||
Line 1,653: | Line 1,653: | ||
=={{header|Objective-C}}== |
=={{header|Objective-C}}== |
||
{{works with|Cocoa}} |
|||
For copying files, using <code>NSFileWrapper</code> is preferred: |
|||
{{works with|GNUstep}} |
|||
<lang objc>[[NSFileManager defaultManager] copyItemAtPath:@"input.txt" toPath:@"output.txt" error:NULL];</lang> |
|||
Read the contents of input.txt and place it in output.txt, creating a file if needed: |
|||
If you want to do it manually: |
|||
<lang objc>NSData *data = [NSData dataWithContentsOfFile:@"input.txt"]; |
<lang objc>NSData *data = [NSData dataWithContentsOfFile:@"input.txt"]; |