unexpected 'end of file' + sed command

hello,

i use this command in my code:

(void) sprintf ( LBuf, "/bin/sed 's/\\[//g;s\//]//g' %s > %s", tmp1,tmp2);

but i get this error :

sh: syntax error at line 1:'end of file' unexpected

any help please
thank you

The C compiler munges \ characters, so writing a command line like this can be a problem. Print LBuf to a file,

chmod +x that_file 
that_file

and see what you get. it is easier to diagnose problems from the command line.

You can also use a command that does not use a lot of metacharacters:

sprintf(LBuf, "/bin/tr -d '[' < %s | tr -d ']' > %s", tmp1, tmp2);'