Graph::printAllPaths
<p>A code which is written in C++  writes a sequence of numbers in the output console.In fact, this code tries to enumerate all path in a graph between a source and a destination node. for example a single run generates:</p>

<p>1,2,3</p>

<p>4,5</p>

<p>6,7 </p>

<p>The whole code can be find in here:</p>

<p><a href="http://www.geeksforgeeks.org/find-paths-given-source-destination/" rel="nofollow noreferrer">http://www.geeksforgeeks.org/find-paths-given-source-destination/</a></p>

<p>What I am trying to do is write these numbers in a text or excel file . I am completely new to C++ so I really appreciate your help on what changes should I do in order to export the output in excel or text file.</p>

<p>Let's say the main code is :</p>

<pre><code>// Driver program
int main()
{
    // Create a graph given in the above diagram
    Graph g(4);
    g.addEdge(0, 1);
    g.addEdge(0, 2);
    g.addEdge(0, 3);
    g.addEdge(2, 0);
    g.addEdge(2, 1);
    g.addEdge(1, 3);
    int s = 2, d = 3;
    g.printAllPaths(s, d);

    return 0;
}
</code></pre>

<p>we already defined <code>g.printAllPaths</code> and  <code>g.addEdge</code>. </p>

<p>What I am trying to do is generate a text file and write the output in there:</p>

<pre><code>ofstream outFile;
outFile.open("sample.txt");
outFile &lt;&lt;g.printAllPaths(s, d)&lt;&lt;endl;
outFile.close();
</code></pre>

<p>but this does not work. </p>