CCDs as X-ray detectors in a high radiation environment