What is the atomically boolean in writeToFile Method?


#1

Hello,

can someone explain me further what is the meaning of atomically:(BOOL)useAuxiliaryFile in this method ?

[quote]- (BOOL)writeToFile:(NSString *)path
atomically:(BOOL)useAuxiliaryFile
encoding:(NSStringEncoding)enc
error:(NSError **)error [/quote]
I did not understand the explanation from the documentation.
thanks by advance


#2

I found the answer by myself a little further in the book with the documentation of

[quote]NSDataWritingOptions
Options for methods used to write NSData objects.

enum {
NSDataWritingAtomic = 1UL << 0,
NSDataWritingWithoutOverwriting = 1UL << 1,
};
typedef NSUInteger NSDataWritingOptions;
Constants
NSDataWritingAtomic
A hint to write data to an auxiliary file first and then exchange the files. This option is equivalent to using a write method taking the parameter atomically:YES.[/quote]
Anyway another question pops up: “Where is located and what is the name of the Auxiliary temporary file ?”


#3

See Managing File Paths in Foundation Functions Reference:

...
NSHomeDirectory
NSHomeDirectoryForUser
NSOpenStepRootDirectory
NSSearchPathForDirectoriesInDomains
NSTemporaryDirectory
...

#4

[quote=“ibex10”]See Managing File Paths in Foundation Functions Reference:

... NSHomeDirectory NSHomeDirectoryForUser NSOpenStepRootDirectory NSSearchPathForDirectoriesInDomains NSTemporaryDirectory ... [/quote]

Thanks a lot ibex10. A lot to “compute” in my brain. Learning Objective-C is really a challenge for me but I keep on trying.