LPSTR from a std::string

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
 I want to get a LPSTR out of a string that I have created - this is to be used in a "createprocess" function which apparently dosnt like to use LPCSTR.
The code that I have looks like a long hand way of doing it. This does seem to work but is there a better way of doing this?

string spawnCommand = somestring;

char spawnChar[1000];
for(int i=0;i<spawnCommand.size();i++){
    spawnChar<img src="/MSDN//emoticons/emotion-55.gif" alt=Idea>=spawnCommand.at(i);
}
spawnChar[spawnCommand.size()]=;
LPSTR spc = spawnChar;

Im using visual c++ express on xp.
Thanks in advance.
Trev


View the full article
 
Back
Top