EmbLogic's Blog

Assignment of exec() system call’

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”);
}

3 Responses to Assignment of exec() system call’

  1. msiddarth says:

    Could you elaborate what kind of issue you are facing

  2. sushant says:

    Not understand the working of the sprintf().

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>