This function opens an existing PCK ephemeris file in order to append ephemeris data to it, whose pathname is the string pointed to by filename, and returns an ephemeris descriptor associated to it. If the file doesn't exist, or if it isn't a PCK file, the function fails and returns NULL. This file must be compliant to the format specified by the 'SPICE' PCK ephemeris file.

The function writeph_close() must be called to free memory allocated by this function.

The following example appends data the ephemeris file ephemeris.bpc

USE, INTRINSIC :: ISO_C_BINDING
use calceph
TYPE(C_PTR) :: weph

weph = writeph_pck_open("ephemeris.bpc"//C_NULL_CHAR)
if (C_ASSOCIATED(weph)) then

     ! ... computation ...

     call writeph_close(weph)
endif