string str = hogehoge();
const char* cp = str.c_str();
if (str[0] == '$') {

とやったら、3行目でおじゃんかよ
ほんとかよ?