We present spectrally resolved observations of triatomic carbon (C-3) in several ro-vibrational transitions between the vibrational ground state and the low-energy nu(2) bending mode at frequencies between 1654-1897 GHz along the sight-lines to the submillimeter continuum sources W31C and W49N, using Herschel's HIFI instrument. We detect C-3 in absorption arising from the warm envelope surrounding the hot core, as indicated by the velocity peak position and shape of the line profile. The sensitivity does not allow to detect C-3 absorption due to diffuse foreground clouds. From the column densities of the rotational levels in the vibrational ground state probed by the absorption we derive a rotation temperature (T-rot) of similar to 50-70 K, which is a good measure of the kinetic temperature of the absorbing gas, as radiative transitions within the vibrational ground state are forbidden. It is also in good agreement with the dust temperatures for W31C and W49N. Applying the partition function correction based on the derived T-rot, we get column densities N(C-3) similar to 7-9 x 10(14) cm(-2) and abundance x(C-3) similar to 10(-8) with respect to H-2. For W31C, using a radiative transfer model including far-infrared pumping by the dust continuum and a temperature gradient within the source along the line of sight we find that a model with x(C-3) = 10(-8), T-kin = 30-50 K, N(C-3) = 1.5 x 10(15) cm(-2) fits the observations reasonably well and provides parameters in very good agreement with the simple excitation analysis.