You are on page 1of 7

Roll No : 9252

Name:Rajlaxmi salokhe

ASSIGNMENT NO:5
Q: C program to implement pwd command of linux through C program.
#include<stdio.h>
#include<conio.h>
#include<dir.h>
void main(int argc)
{
char*path;
clrscr();
if(argc>2)
{
printf("\nn too many parameters");
}
if(argc==1)
{
getcwd(path,50);
printf("\n print working directory:%s",path);
}
getch();
}
ASSIGNMENT NO:6
Q: C program to implement rename command of DOS.
#include<stdio.h>
#include<conio.h>
#include<dir.h>
void main(int argc,char*argv[])
{
clrscr();
if(argc<3)
{
printf("\n invalid parameter");
}
if(argc>3)
{
printf("\n too many parameters");
}
if(argc==3)
{
if(rename(argv[1],argv[2])==0)
{
printf("\n file %s is renamed as : %s",argv[1],argv[2]);
}
}
getch();
}

You might also like