forked from OSchip/llvm-project
Simplied main() and emits a message to the standard out.
llvm-svn: 114033
This commit is contained in:
parent
33e7e5d89b
commit
f7f627104b
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue