title: C++ how to use a variable in a string
body: <p>The following code doesn't work:</p>
  
  <pre><code>string currency;
  currency = "EURUSD";
  
  system("lynx -dump 'http://somesite.com/q?s="+currency+"=X' &gt; file.txt");
  </code></pre>
  
  <p>How do I use <code>currency</code> inside this line of C++'s <code>system()</code> call?</p>
  
  <p>This is my error:</p>
  
  <pre><code>Error value:
  main.cpp: In function ‘int main()’:
  main.cpp:22:84: error: cannot convert ‘std::basic_string&lt;char&gt;’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
  make: *** [main.o] Error 1
  BUILD FAILED (exit value 2, total time: 890ms)
  </code></pre>
  
  <p>In PHP I use <code>.</code> to join strings, but in C++ I am not sure of the syntax.</p>