Maybe std::isprint instead? With some other STL magic (something like std::find_if, not sure which one it is), this could probably even be written as one line (or two)...which may be more readable (or may not, in which case I'd just drop it :p)