Manually getting the output instead of output redirection in cmd line
<p>I have a C++ program which has the prototype of the main function as follows:</p>

<p><code>int main(int argc, char * argv[])</code></p>

<p>The code hasn't been written by me, but this is a single C file available <a href="http://tartarus.org/~martin/PorterStemmer/c.txt" rel="nofollow">here</a>. 
When I compile this code, and through the command line run it as:</p>

<p><code>someexe in.txt &gt; out.txt</code><br/>
This gives me an output out.txt which is generated in the same directory by operating on some input from in.txt.</p>

<p><code>someexe in.txt out.txt</code><br/>
This gives me an output on the command line itself. (without using <code>&gt;</code> operator)</p>

<p>However, instead of passing the command line argument and without using the output redirection <code>&gt;</code> operator, I have been trying to call the main function from another function and passing the parameters myself. If I pass an array of <code>char*</code> {fileDirName, in.txt}, I am not sure how to go about generating an out.txt (since I think <code>&gt;</code> output redirection is an operating system level function available in command line).</p>

<p>Any suggestions would be greatly appreciated</p>

<p>The program in the link is readily available as copy paste and can be tried (main function is written at the last in the above program)</p>
