You should probably use a stringstream here, rather than using concatenation. But, it's probably not a big deal, since this isn't really the performance-critical part of the code.