title: How to get first two chars from a string and use the two chars in another string
body: <p>I would like to get the first two chars from my string. Lets say my string <code>dbdir = "Dir"</code> and my other string <code>test = "20122"</code>. I want to get the first two chars from test and combine it with dbdir string. So the result would be string combined = Dir20 then I want to use the combined string in another string for a file. </p>
  
  <p>Here is my code</p>
  
  <pre><code>std::string dbdir = "Dir";
  std::string test = "20122";
  
  //strip first two chars from test//
  std::string result_of_test_strip = ;
  
  std::string combined = ""+ dbdir + result +"";
  CString fileToOpen = "\"\\\\CAR\\VOL1\\Docs\\PRE\\15\\" + result_of_test_strip.c_str() +  "\\" + filenum.c_str() + ".prt" + "\"";
  </code></pre>
  
  <p>Suggested answer @therainmaker</p>
  
  <pre><code>      std::string dbdir = "Dir";
        std::string test = "20122";
        std::string result = test.substr(0, 2); 
        std::string combined = dbdir + result;
  
        CString fileToOpen = "\"\\\\CAR\\VOL1\\Docs\\PRE\\15\\" + combined.c_str() + "\\" + filenum.c_str() + ".prt" + "\"";
  </code></pre>
  
  <h1>I get this error in CString fileToOpen ---></h1>
  
  <h1>error C2110: cannot add two pointers Error executing cl.exe.</h1>