Doping of low-temperature GaAs and GaMnAs with carbon