Enter stringstream into shellexecute?

Hey I have been trying to make a small program that runs a bit of CMD. The only problem was that the file location has quotation marks in it. I am unsure how to include these, since system(""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --proxy-server=190.151.8.246:8080") will not work because of the quotes.

After lots of looking around, I found I could pass the quotes into a line using a stringstream like this
1
2
3
4
5
6
   int quote = 34;
   char quotation = quote;
std::ostringstream location;

  location << quotation << "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" << quotation << " " << "--proxy-server=190.151.8.246:8080";
std::string var = location.str();


The only problem is I don't know how to run this through system or shellexecute. I can't find anything online that I can understand. Does anyone know of a way to do this?

My code is currently

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <windows.h>
#include <string>
#include <sstream>
using namespace std;

int main()
{
   int quote = 34;
   char quotation = quote;
std::ostringstream location;

  location << quotation << "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" << quotation << " " << "--proxy-server=190.151.8.246:8080";
std::string var = location.str();


	ShellExecuteA(GetDesktopWindow(), ("open"), LPCSTR(location.str()), NULL, NULL, SW_SHOWNORMAL);



	ShellExecute(NULL, "open", "http://website.com",
			NULL, NULL, SW_SHOWNORMAL);
}


I would really appreciate any help guys, I am completely out of ideas. All I have to do is run a cmd with quotations around the location, I just can't figure this out.
Well I fixed the issue haha just took some more searching around.
Topic archived. No new replies allowed.