Function

CFURLWriteDataAndPropertiesToResource

Writes the given data and properties to a given URL.

Declaration

Boolean CFURLWriteDataAndPropertiesToResource(CFURLRef url, CFDataRef dataToWrite, CFDictionaryRef propertiesToWrite, SInt32 *errorCode);

Parameters

url

The resource to write.

dataToWrite

The data to write. Pass NULL to write only properties.

propertiesToWrite

The properties to write. Pass NULL to write only data. See File URL Properties and HTTP URL Properties for the list of available properties.

errorCode

Upon return, 0 if successful, otherwise contains an error code indicating the nature of the problem. See CFURLError for a list of possible error codes.

Return Value

true if successful, false otherwise.

Discussion

Properties not present in propertiesToWrite are left unchanged, hence if propertiesToWrite is NULL or empty, the URL's properties are not changed at all.

If url uses a file scheme and it references a file, the contents of dataToWrite are written to the referenced file, overwriting any preexisting data, and the file’s properties are modified according to propertiesToWrite. If the file does not exist, but all intermediate directories along the path do already exist, the file is created (otherwise it is not).

If url uses a file scheme and it references a directory (the last path character is "/"), the contents of dataToWrite are ignored, but if the parameter value is not NULL—and all intermediate directories along the path do already exist—a new directory is created (otherwise it is not).

If url uses an http scheme, an http PUT request is sent to the resource with propertiesToWrite as the header fields and dataToWrite as the data.

See Also

Core Foundation URL Access Utilities Miscellaneous Functions

CFURLCreateDataAndPropertiesFromResource

Loads the data and properties referred to by a given URL.

Deprecated
CFURLCreatePropertyFromResource

Returns a given property specified by a given URL and property string.

Deprecated
CFURLDestroyResource

Destroys a resource indicated by a given URL.

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software