System Software Lab 12 | Read Now

System Software VTU Lab

Program 12:- Write a C++ program to emulate the Unix ln command


System Software Lab 12 Code [lab12.cpp]

#include<iostream>
#inculde<unistd.h>

int main(int argc, char* argv[])
{
 using namespace std;
 if(argc!=3)
 {
  cout<<"Usage ./a.out sourcefile destination file\n";
  return 0;
 }
 if(link(argv[1],argv[2])==-1)
 {
  cout<<"cant link\n";
  return 1;
 }
 else
 {
  cout<<"Files have been Linked\n";
 }
return 0;
}

Output

System Software

Leave a Reply

Your email address will not be published. Required fields are marked *

WhatsApp Icon Join For Job Alerts