【发布时间】:2019-05-28 07:43:47
【问题描述】:
我有一个我可以通过名称理解的以下方法将输出转换为漂亮的格式以显示。但我不明白这段代码在做什么,它的返回类型是什么。如何将此返回类型分配给我想从javascript访问的字符串数据类型
std::ostream & prettyPrintRaw(std::ostream &out, const std::vector<unsigned char> &buf) {
vector<unsigned char>::const_iterator ptr = buf.begin();
vector<unsigned char>::const_iterator end = buf.end();
int i = 0;
while (ptr != end) {
char c = (char) *ptr;
if (c >= ' ' && c <= '~') {
out.put(c);
barCodeDataChar[i] = c;
i++;
}
else
out << '{' << (int) c << '}';
ptr++;
} // end while
return out;
} // end function
抱歉,我无法对 piece 的代码进行漂亮格式化
【问题讨论】:
标签: javascript c++ visual-studio