Simple C++ code to process addressing string