// 入力値をintに変換 int code = inCode; // カラーコードとして正しい範囲内か検査 if(0<=code && code<=0xffffff){ …