Concatenation of strings in C++ (Linux)
<p>I want to concatenate three string in C++.</p>

<p>I have a vector <code>std::vector&lt;std::string&gt; my_list</code> where the filenames are stored. I want to add the directory and filename extension for each of the filenames in order to read binary the information from the file, so i do it like that:</p>

<pre><code>for (int i = 0; i &lt; my_list.size(); i++) {
        std::string tmp = prefix + my_list[i] + suffix;
        std::ifstream file(tmp.c_str(), std::ifstream::binary);
}
</code></pre>

<p>where <strong>prefix</strong> ist std::string prefix = "directory/" and <strong>suffix</strong> ist std::string suffix = ".foo".</p>

<p>And it works in Windows. However it doesn't work in Linux. 
Suffix overwrites "tmp"-string. It looks like <code>foo/y_file_timestamp</code> instead of <code>out/my_file_timestamp.foo</code>.</p>

<p>What should I do to prevent this overwriting?</p>