Hi, I am trying to use system() to run some command in OS. such as system("cmd 'a\tb') however, it alway runs cmd 'a b' instead of cmd 'a\tb' How can I prevent system to interpret 'a\tb' to 'a b'? Thanks [[alternative HTML version deleted]]
You could escape the backslash. system("cmd 'a\\tb'") On Thu, Jul 21, 2016 at 4:00 PM, Michael Peng <michael.gang.peng at gmail.com> wrote:> Hi, > > I am trying to use system() to run some command in OS. such as > > system("cmd 'a\tb') > > however, it alway runs > cmd 'a b' > instead of > cmd 'a\tb' > > How can I prevent system to interpret 'a\tb' to 'a b'? > > > Thanks-- Sarah Goslee http://www.functionaldiversity.org
Yes. I forgot to escape the escape. Thank you so much. 2016-07-21 16:07 GMT-04:00 Sarah Goslee <sarah.goslee at gmail.com>:> You could escape the backslash. > > system("cmd 'a\\tb'") > > > On Thu, Jul 21, 2016 at 4:00 PM, Michael Peng > <michael.gang.peng at gmail.com> wrote: > > Hi, > > > > I am trying to use system() to run some command in OS. such as > > > > system("cmd 'a\tb') > > > > however, it alway runs > > cmd 'a b' > > instead of > > cmd 'a\tb' > > > > How can I prevent system to interpret 'a\tb' to 'a b'? > > > > > > Thanks > > -- > Sarah Goslee > http://www.functionaldiversity.org >[[alternative HTML version deleted]]