next up previous contents Back To Software Index
Next: Current Header Data Up: Disk FilesMemory-Resident Previous: Reading or Writing

Piped FITS Files via STDIN and STDOUT.

A related feature of CFITSIO is the ability to read FITS files from the 'stdin' file stream and write them to the 'stdout' file stream. This can be used to 'pipe' FITS files directly from one task to another without the overhead of creating intermediate disk files. Internally CFITSIO creates a memory buffer large enough to temporarily hold the entire FITS file so the machine must have an appropriate amount of memory for this feature to work efficiently. To read from stdin simply specify the name of the FITS file to be opened in the fits_open_file routine as "-", and similarly specify the name of the FITS file as "-" in the fits_create_file routine to write to the stdout stream. It is not required to call `fits_set_mem_buff' when simply reading or writing files to stdin or stdout. Two test programs called listhead.c and copyfits.c give examples of reading from stdin or writing to stdout.