Access permissions for the destination file if it is created. In place of the usual or'd combination of file permissions, the value APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied.

This function should be used in preference to explicit manipulation of the file permissions, because the operations to provide these attributes are platform specific and may involve more than simply setting permission bits.

Warning:

Platforms which do not implement this feature will return APR_ENOTIMPL.

It is possible to add a buffer to previously unbuffered file handles, the APR_FOPEN_BUFFERED flag will be added to the file handle's flags. Likewise, with buffer=NULL and bufsize=0 arguments it is possible to make a previously buffered file handle unbuffered.

Access permissions for the new file if it is created. In place of the usual or'd combination of file permissions, the value APR_FPROT_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied.

file (un)locking functions. Establish a lock on the specified, open file. The lock may be advisory or mandatory, at the discretion of the platform. The lock applies to the file as a whole, rather than a specific range. Locks are established on a per-thread/process basis; a second lock by the same thread will not block.

This function generates a unique temporary file name from template. The last six characters of template must be XXXXXX and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array.

The only reason that the apr_file_open_std* functions exist is that you may not always have a stderr/out/in on Windows. This is generally a problem with newer versions of Windows and services.

The other problem is that the C library functions generally work differently on Windows and Unix. So, by using apr_file_open_std* functions, you can get a handle to an APR struct that works with the APR functions which are supposed to work identically on all platforms.

Some platforms cannot toggle between blocking and nonblocking, and when passing a pipe as a standard handle to an application which does not expect it, a non-blocking stream will fluxor the client app.

Some platforms cannot toggle between blocking and nonblocking, and when passing a pipe as a standard handle to an application which does not expect it, a non-blocking stream will fluxor the client app. Use this function rather than apr_file_pipe_create() to create pipes where one or both ends require non-blocking semantics.

On entry, the number of bytes to read; on exit, the number of bytes read.

Remarks:

apr_file_read() will read up to the specified number of bytes, but never more. If there isn't enough data to fill that number of bytes, all of the available data is read. The third argument is modified to reflect the number of bytes read. If a char was put back into the stream via ungetc, it will be the first character returned.

It is not possible for both bytes to be read and an APR_EOF or other error to be returned. APR_EINTR is never returned.

Read data from the specified file, ensuring that the buffer is filled before returning.

Parameters:

thefile

The file descriptor to read from.

buf

The buffer to store the data to.

nbytes

The number of bytes to read.

bytes_read

If non-NULL, this will contain the number of bytes read.

Remarks:

apr_file_read_full() will read up to the specified number of bytes, but never more. If there isn't enough data to fill that number of bytes, then the process/thread will block until it is available or EOF is reached. If a char was put back into the stream via ungetc, it will be the first character returned.

It is possible for both bytes to be read and an error to be returned. And if *bytes_read is less than nbytes, an accompanying error is _always_ returned.

On entry, the number of bytes to write; on exit, the number of bytes written.

Remarks:

apr_file_write() will write up to the specified number of bytes, but never more. If the OS cannot write that many bytes, it will write as many as it can. The third argument is modified to reflect the * number of bytes written.

It is possible for both bytes to be written and an error to be returned. APR_EINTR is never returned.

Write data to the specified file, ensuring that all of the data is written before returning.

Parameters:

thefile

The file descriptor to write to.

buf

The buffer which contains the data.

nbytes

The number of bytes to write.

bytes_written

If non-NULL, set to the number of bytes written.

Remarks:

apr_file_write_full() will write up to the specified number of bytes, but never more. If the OS cannot write that many bytes, the process/thread will block until they can be written. Exceptional error such as "out of space" or "pipe closed" will terminate with an error.

It is possible for both bytes to be written and an error to be returned. And if *bytes_written is less than nbytes, an accompanying error is _always_ returned.