int main()
{
int fd,wr;
char ch[]=”Emblogic”;
char *name;
name = malloc(sizeof(char)*233);
if(name==NULL)
{
perror(“Malloc”);
}
fd=open(“file.txt”,O_WRONLY);
printf(“File descripter =%d\n”,fd);
wr = write(fd,ch,7);
if(wr == -1)
{
perror(“write”);
}
printf(“wr =%d\n”,wr);
sprintf(name,”%d”,fd);
printf(“%s\n”,name);
execl(“fd1″,”fd1″,name,0);
printf(“Bye\n”);
}
Could you elaborate what kind of issue you are facing
Not understand the working of the sprintf().
Here sprintf convert interger into string so that we can pass fd as an argument in execl command.