Linked Questions
96 questions linked to/from How to convert a std::string to const char* or char*
1
vote
2
answers
1k
views
How to convert a C++ string to a char*? [duplicate]
Possible Duplicate:
Convert std::string to const char* or char*
Simple question but I'm new to C++. How do I convert a string to a char * (I read a string from cin then I have a function that ...
0
votes
1
answer
2k
views
Why can't I provide a string argument to printw in ncurses? [duplicate]
For an application that I'm writing, I have a string type variable that I want to display within an ncurses window:
#include <iostream>
#include <ncurses.h>
#include <string>
int ...
0
votes
1
answer
1k
views
Copying a std::string to char* [duplicate]
I am trying to create a copy of a std::string to a char*. This is my function and its seen result:
void main()
{
std::string test1;
std::cout << "Enter Data1" << std::endl;
std::cin >&...
-1
votes
1
answer
2k
views
Convert an Arduino C++ String to an ANSI C string (char* array) using the String method .c_str() [duplicate]
because many posts about this problem are misleading or ambiguous, this is how it works, just for the record (tested):
How to convert an Arduino C++ String to an ANSI C string (char* array) using the ...
1
vote
2
answers
738
views
Trying to Convert String to Character Pointer? [duplicate]
I've been trying everything under the sun to do the simple following:
1) Receive an input string from stdin.
2) Convert it to a char pointer so I can pass to a tabling/palindrome finding function.
...
-1
votes
1
answer
267
views
no suitable conversion function from "std::string" to "const char *" exists c++ [duplicate]
It's a simple program for version numbers directories. It fails to compile with this error:
no suitable conversion function from "std::string" to "const char *" exists
#include &...
0
votes
2
answers
436
views
STL map and c++ [duplicate]
Possible Duplicate:
Convert std::string to const char* or char*
is there any to get the string back from the stl map and into a char array??
multimap<string, string> testcase;
testcase....
-2
votes
1
answer
207
views
implement zip and unzip in c++. I'm confuse about the char* buffer [duplicate]
The two functions below are about to implement zip and unzip, but I have problems selecting the correct type buffer to save the string from the file.
Also, for char* ptr = line, which is declared a ...
0
votes
1
answer
206
views
How to properly convert parameters to const char *? [duplicate]
I got the following errors while compiling, here's the problem part of code. Please help me understand what's wrong?
for (std::vector<std::string>::iterator i = files.begin(), end = files.end();...
-1
votes
1
answer
176
views
"No suitable conversion function" [duplicate]
I was trying to make a program that can open websites via running a command in the shell. But I get this error: "no suitable conversion function from "std::__1::string" to "const ...
-2
votes
1
answer
126
views
C++ is executing cmd command by input possible? [duplicate]
I want to create sth like:
int main ()
{
string s{};
std::cout << "Enter CMD: \n";
getline(cin,s);
system(s);
}
But since I can use only const char on ...
1
vote
0
answers
119
views
How do you convert string to c_str() in this situation? [duplicate]
Possible Duplicate:
Convert std::string to const char* or char*
My code is this
#include <iostream>
#include <fstream>
using namespace std;
string mapChange(int side, string oldMap)...
-2
votes
2
answers
87
views
Concerting char* to string to be read into file? [duplicate]
I am trying to read in an input from a user and I know my method needs a char* but is there anyway to make the input of cin able to be used by that char? (look at the comment at char* x.)
string y;
...
-2
votes
1
answer
57
views
Generating a char using input from user in C++ [duplicate]
I wish to make a char with digits between 0-9. The user decides how many digits to use.
For example, if the user inputs 4, the char should be 01234.
Please note I cannot use the string data type. I ...
0
votes
1
answer
53
views
How can I use std::string for Const Char Parameter [duplicate]
I am trying to use the std::rename() function to move a .docx file, however, the name of the file may vary. How can I use a std::string within std::rename() so that it does not have to be a hardcoded ...