Ibrahim Haddad wrote:

> I have a slight problem.
> I am checking if a structure variable is empty to display a warning window
> (with 
> motif) and if the variable holds a value (file name), I want to go ahead and 
> delete the file using a system call to "rm -f"
> 
> My code:
> --------
>  if (strcmp(castedPtr->tname, "") == 0)
>     /* check if string is empty and display warning message */
>     missingInputCB (w, clientData, callData);
>   else /* delete file name that matches the value of castedPtr->tname */
>     system("rm -f castedPtr->tname");
> 
> However,     system("rm -f castedPtr->tname")
> is not working because the rm command will be searching for a file called 
> castedPtr->tname to delete it while in fact this pointer holds the file name.
> 
> Is there a way to get around this?

Don't use system for this; just use

        unlink(castedPtr->tname);

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to