Creates and returns an initialized output stream for writing to a specified file.
SDKs
- iOS 2.0+
- macOS 10.3+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Foundation
Declaration
+ (instancetype)outputStreamToFileAtPath:(NSString *)path append:(BOOL)shouldAppend;
Parameters
path
The path to the file the output stream will write to.
shouldAppend
YES
if newly written data should be appended to any existing file contents, otherwiseNO
.
Return Value
An initialized output stream that can write to path
.
Discussion
The stream must be opened before it can be used.