Next: 3.6 Automatic resource deallocation Up: 3. The VIPS image Previous: 3.4 Eval callbacks Contents

# 3.5 Detailed rules for descriptors

These rules are intended to answer awkward questions.

1. You can output to a descriptor only once.

2. You can use a descriptor as an input many times.

3. You can only output to a descriptor that was opened with modes `"w"`, `"t"` and `"p"`.

4. You can only use a descriptor as input if it was opened with modes `"r"` or `"rw"`.

5. If you have output to a descriptor, you may subsequently use it as an input. `"w"` descriptors are automatically changed to `"r"` descriptors.

   If the function you are passing the descriptor to uses WIO (see §3.8.6), then `"p"` descriptors become `"t"`. If the function you are passing the descriptor to uses PIO, then `"p"` descriptors are unchanged.