I've got a program that formats a data file and outputs it to a different filename.



My input looks like this

ifstream openFile ("BATCH002.DAT");
if (openFile.is_open())
{

while (! openFile.eof() )
{

getline (openFile,line);

oneArray[q] = stripSpace(line);

q++;

}

openFile.close();

my output looks like this:

ofstream outputFile("OUTPUT2.TXT");
if (outputFile.is_open())
{
for (int k = 0; k < arrayHeight; k++)
{
if (oneArray[k] != "") outputFile << oneArray[k] << "\t\t\t\t" << twoInts[k] <<"\n";
}

outputFile.close;
}
else cout << "Error opening file.";
}

I don't want the input and output filenames hard coded. I know you can use argv and argc in the main() to get the command line arguments into variables. The problem is that when I replace "BATCH002.DAT" or "OUTPUT2.TXT" with a variable my program errors.