Printing "\" to system with C not work? -


i have coded little app following:

sprintf(command, "......sending string system......{} \;" printf("%s\n",command); system(command); break; 

the problem not whole string sent system, appears in shell apart '\' doesn't reason? sure silly mistake really, novice. thank you

the \ escape character (you used print newline using \n), if want print literal backslash, need use \\:

sprintf(command, "......sending string system......{} \\;" //                                                            ^^ //                                                      take note here 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -