Simplied main() and emits a message to the standard out.

llvm-svn: 114033
This commit is contained in:
Johnny Chen 2010-09-15 22:48:40 +00:00
parent 33e7e5d89b
commit f7f627104b
1 changed files with 8 additions and 9 deletions

View File

@ -10,26 +10,23 @@
#include <cstdlib>
#include <string>
#include <fstream>
#include <iostream>
int
main(int argc, char const *argv[])
{
char const *cptr = NULL;
// The program writes its output to the "output.txt" file.
std::ofstream outfile("output.txt");
for (unsigned i = 0, e = sizeof(argv); i < e; ++i) {
if ((cptr = argv[i]) == NULL)
break;
std::string str(cptr);
if (i == 1 && "A" == str)
for (unsigned i = 0; i < argc; ++i) {
std::string theArg(argv[i]);
if (i == 1 && "A" == theArg)
outfile << "argv[1] matches\n";
if (i == 2 && "B" == str)
if (i == 2 && "B" == theArg)
outfile << "argv[2] matches\n";
if (i == 3 && "C" == str)
if (i == 3 && "C" == theArg)
outfile << "argv[3] matches\n";
}
@ -40,5 +37,7 @@ main(int argc, char const *argv[])
}
}
std::cout << "This message should go to standard out.\n";
return 0;
}