#include <iostream.h>
#include "int_file.hpp"
#include "boolean.hpp"
#include "program.hpp"
main()
{
Internal_File old_file;
Internal_File new_file;
Internal_ByteArray buffer(100);
Internal_ByteSize bytes;
Boolean done;
old_file.open(FileName("abc.dat"));
if (old_file.error() != Internal_File::No_error)
{
cout << "Unable to open file abc.dat";
program_exit(Failure);
}
new_file.create(FileName("def.dat"));
if (new_file.error() != Internal_File::No_error)
{
cout << "Unable to open for writing def.dat";
program_exit(Failure);
}
// Copy the files
do
{
old_file.read(buffer);
switch(old_file.error())
{
case Internal_File::No_error:
done = False;
break;
case Internal_File::End_of_file:
done = True;
break;
default:
cout << "Error in reading";
done = True;
break;
}
new_file.write(buffer);
if (new_file.error() != Internal_File::No_error)
{
cout << "Error in writing";
done = True;
break;
}
} while (!done);
old_file.close();
new_file.close();
}
// End of File