  Precise determinations of the chemical composition in early B-type stars
consitute fundamental observational constraints on stellar and galactochemical
evolution. Carbon is one of the most abundant metals in the Universe but
analyses in early-type stars show inconclusive results, like large
discrepancies between analyses of different lines in C II, a failure to
establish the C II/III ionization balance and the derivation of systematically
lower abundances than from other objects. We present a comprehensive and robust
C II/III/IV model for non-LTE line-formation calculations based on carefully
selected atomic data. The model is calibrated with high-S/N spectra of six
apparently slow-rotating early B-type dwarfs and giants, which cover a wide
parameter range and are randomly distributed in the solar neighbourhood. A
self-consistent quantitative spectrum analysis is performed using an extensive
iteration scheme to determine stellar atmospheric parameters and to select the
appropriate atomic data used for the derivation of chemical abundances. We
establish the carbon ionization balance for all sample stars based on a unique
set of input atomic data, achieving consistency for all modelled lines. Highly
accurate atmospheric parameters and a homogeneous carbon abundance with reduced
systematic errors are derived. This results in a present-day stellar carbon
abundance in the solar neighbourhood, which is in good agreement with recent
determinations of the solar value and with the gas-phase abundance of the Orion
H II region. The homogeneous present-day carbon abundance also conforms with
predictions of chemical-evolution models for the Galaxy. The present approach
allows us to constrain the effects of systematic errors on fundamental
parameters and abundances. (abridged)

Astrophysics