Linked Questions
99 questions linked to/from How can I convert int to string in C++?
165 votes
18 answers
357k views
Alternative to itoa() for converting integer to string C++? [duplicate]
I was wondering if there was an alternative to itoa() for converting an integer to a string because when I run it in visual Studio I get warnings, and when I try to build my program under Linux, I get ...
9 votes
3 answers
28k views
inserting int variable in file name [duplicate]
Possible Duplicate: Easiest way to convert int to string in C++ How can I insert int variable while creating .vtk file? I want to create file at every k step. i.e. so there should be series of ...
1 vote
4 answers
773 views
what's concise C++ idiom for conversion from int|double to string? [duplicate]
Looking through related Q&A's, it seems that best C++ practice for conversion to string is ostringstream stringStream; stringStream << input_value; // let's say, input_value is a ...
3 votes
3 answers
18k views
C++ - Alternative to Integer.parseInt() and String.valueOf() [duplicate]
In C++. What are the alternatives to Integer.parseInt() and String.valueOf() of Java in C++.
1 vote
3 answers
17k views
Convert a Long in a String C++? [duplicate]
Possible Duplicate: C++ long to string Easiest way to convert int to string in C++ I am use to Java where I could just use .toString() on almost anything but I am trying a few problems in C++ I ...
5 votes
3 answers
988 views
How to convert an integer to a string [duplicate]
I want to convert an integer to a string. I tried it this way but this didn't work void foo() { int y = 1; string x = static_cast<string>(y); }
5 votes
4 answers
1k views
Best way to cast numbers into strings in C++? [duplicate]
Coming from a C# background, In C# I could write this: int int1 = 0; double double1 = 0; float float1 = 0; string str = "words" + int1 + double1 + float1; ..and the casting to strings is ...
0 votes
3 answers
3k views
why does concersion from int to const char* break C++ [duplicate]
hi recently I was learning C++ in Visual studio when I stopped on a problem when I want to use my method to log an int i need to convert it to const char* but when I do it things just crash is my code:...
2 votes
3 answers
2k views
How to convert intptr_t to string [duplicate]
Possible Duplicate: Easiest way to convert int to string in C++ Does anyone know how to do that conversion? I need to concatenate a intptr_t type to a string, and therefore need to convert it. ...
0 votes
3 answers
763 views
Simple C++ - about strings and concatenation and converting int to string [duplicate]
Possible Duplicate: Easiest way to convert int to string in C++ I have a question about Visual C++ Strings. I want to concatenate the next string. for (int i=0; i<23; i++) { imagelist....
-2 votes
3 answers
832 views
How to convert int and std::string to char*? [duplicate]
How to convert int and std::string to char* ? I'm trying to do this : int a = 1; std::string b = "str"; char* x = a + b; I don't want something like this: std::stringstream ss; std::string str2char;...
1 vote
3 answers
399 views
Binary Search Tree, cannot cast from Int to string [duplicate]
I am trying to code a Binary tree and am currently trying to get an 'inorder' function to work which takes in a binary tree containing integers and outputs the binary tree to a string in numerical ...
-2 votes
2 answers
499 views
convert integer to string for function parameter [duplicate]
I have a function which accept a string parameter and I have an integer variable then I should convert it to string and then pass it to that function I used this code but as ostringstream is for I/O ...
0 votes
3 answers
437 views
How to print a variable using string using C++ [duplicate]
Suppose my code is: int x = 4; string alpha; Now i want to print x using alpha, that is using cout << alpha; For example in this case i want 4 to be printed on screen, how to do this ?
-3 votes
1 answer
733 views
How Can I Rewrite Without Stod() [duplicate]
How can I rewrite my readDetails function without using stod() or strtod() in C++? The compiler I will be using doesn't have c++11 enabled and I get 'stod' was not declared in this scope error int ...