A spectral line survey of IRC +10216 at millimeter and submillimeter wavelengths