integer res
character(len=CALCEPH_MAX_CONSTANTVALUE, kind=C_CHAR) UNIT
TYPE(C_PTR) :: peph

peph = calceph_open("example1.dat"//C_NULL_CHAR)
if (C_ASSOCIATED(peph)) then
    ! print the value of UNIT
    if (calceph_getconstantss(peph, "UNIT"//C_NULL_CHAR, UNIT).eq.1) then
        write (*,*) "UNIT=", trim(UNIT)
    endif

    call calceph_close(peph)
 endif