代码:
#include
#include
#include
#include
#include
int main(int argc,char* argv[])
{
std::string Name1st, Name2nd;
if (3 != argc)
{
std::cout << "Input the first file name : \n";
std::cin >> Name1st;
std::cout << "Input the second file name : \n";
std::cin >> Name2nd;
}
else
{
Name1st = argv[1];
Name2nd = argv[2];
}
std::ofstream fout;
std::ifstream fin1st, fin2nd;
fin1st.open(Name1st.c_str(), std::ios_base::in | std::ios_base::binary);
if (fin1st.is_open())
std::cout << "Successfully open " << Name1st << std::endl;
else
{
std::cerr << "Error in opening " << Name1st << std::endl;
std::cin.get();
std::cin.get();
std::exit(EXIT_FAILURE);
}
fin2nd.open(Name2nd.c_str(), std::ios_base::in | std::ios_base::binary);
if (fin2nd.is_open())
std::cout << "Successfully open " << Name2nd << std: