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

javascript - How to diff two immutable objects -

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

javascript - React.js: onClick function from child to parent -