  We present a model atom for C I - C II - C III - C IV using the most
up-to-date atomic data and evaluated the non-local thermodynamic equilibrium
(NLTE) line formation in classical 1D atmospheric models of O-B-type stars. Our
models predict the emission lines of C II 9903~\AA\ and 18535~\AA\ to appear at
effective temperature \Teff~$\geq$~17\,500~K, those of C II 6151~\AA\ and
6461~\AA\ to appear at \Teff~$>$~25\,000~K, and those of C III 5695, 6728--44,
9701--17~\AA\ to appear at \Teff~$\geq$~35\,000~K (log~$g$=4.0). Emission
occurs in the lines of minority species, where the
photoionization-recombination mechanism provides a depopulation of the lower
levels to a greater extent than the upper levels. For C II 9903 and 18535~\AA,
the upper levels are mainly populated from C III reservoir through the Rydberg
states. For C III 5695 and 6728--44~\AA, the lower levels are depopulated due
to photon losses in UV transitions at 885, 1308, and 1426--28~\AA\ which become
optically thin in the photosphere. We analysed the lines of C I, C II, C III,
and C IV for twenty-two O-B-type stars with temperature range between 15\,800
$\leq$~\Teff~$\leq$ 38\,000~K. Abundances from emission lines of C I, C II and
C III are in agreement with those from absorption ones for most of the stars.
We obtained log~$\epsilon_{\rm C}$=8.36$\pm$0.08 from twenty B-type stars, that
is in line with the present-day Cosmic Abundance Standard. The obtained carbon
abundances in 15~Mon and HD~42088 from emission and absorption lines are
8.27$\pm$0.11 and 8.31$\pm$0.11, respectively.
