#include #include #include using namespace std; int main(int argc, char * argv[]) { if (argc != 3) { cout << argv[0] << " oldfile newfile" << endl; return 1; } if (access(argv[1],F_OK) != 0) { cout << "No access to source " << argv[1] << endl; return 1; } if (access(argv[2],F_OK) == 0) { cout << "Warning: destination file " << argv[2] << " exists." << endl; } if (link(argv[1],argv[2]) != 0) { perror("Link failed "); cout << "Could not link " << argv[1] << " and " << argv[2] << endl; } return 0; }