Which one is better option to remove a file from linux system : <p>I want to remove a file present in /tmp, say san.txt</p>

<p>I have two approach, Which one is better and why ?</p>

<p>approach one:</p>

<pre><code>int main(){
        int status;
        pid_t pid = fork();
        if(-1 == pid){
                printf("fork() failed");
                exit(EXIT_FAILURE);
        }else if(pid == 0){
                execl("/bin/sh", "sh", "-c", "rm /tmp/san.txt", (char *) NULL);
        }else{
                printf("[%d]fork with id %d\n",pid);
                waitpid(pid,&amp;status,0);
        }
return 0;
}
</code></pre>

<p>Approach 2: </p>

<pre><code>int main(){
        int ret = unlink("/tmp/san.txt");
        if ( 0 == ret){
                printf("file removed \n");
        }
        return 0;
}
</code></pre>
