c++ Function to add an extra '\' to a filepath?
<p>I have about 3500 full file paths to sort through <code>(ex. "C:\Users\Nick\Documents\ReadIns\NC_000852.gbk")</code>. I just learned that c++ does not recognize the single backslash when reading in a file path. I have about 3500 file paths that I am reading in so it would be overly tedious to manually change each one.</p>

<p>I have this <code>for</code> loop that finds the single backslash and inserts a double backslash at that index. This:</p>

<pre><code>string line = "C:\Users\Nick\Documents\ReadIns\NC_000852.gbk";
    for (unsigned int i = 0; i &lt; filepath.size(); i++) {
        if(filepath[i] == '\') {
            filepath.insert(i, '\');
        }
    }
</code></pre>

<p>However, c++, specifically on c::b, does not compile because of the backslash character. Is there a way to add in the extra backslash character with a function?</p>

<p>I am reading the filepaths in from a text file, so they are being read into the <code>string filepath</code> variable, this is just a test. </p>