Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How to print out ASCII character given number in C++?

I am calculating an integer based on an barcode image. The int will have a value between 1 (2^0) and 256(2^8). I am trying to create a string of characters, each represented by the int which I get from evaluating an individual column of a barcode.

I don't know how to convert an int to a string and then append that string to the end of another string (an empty one initially). I have tried the following (where col_sum is my integer):

string temp_str, full_temp_str;

stringstream ss;

char temp_char;

temp_char = (char)col_sum;

ss << temp_char;

ss >> temp_str;

full_temp_str.append(temp_str);

1 Answer

Relevance
Still have questions? Get your answers by asking now.