Computing.Net > Forums > Linux > problem in system call in .cpp file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

problem in system call in .cpp file

Reply to Message Icon

Name: amit verma
Date: May 31, 2007 at 06:18:55 Pacific
OS: linux
CPU/Ram: 512
Product: compaq
Comment:

hi all
i am trying to exute this whole shell command
in our .cpp programme

/usr/sbin/pppd /dev/ttyS0 115200 crtscts debug dump defaultroute usepeerdns noauth connect '/usr/sbin/chat -v "" at+crm=1 OK "atdt#777" CONNECT' mru 254"

can any body tell how to execute this whole command in our .cpp file using system call.

i am trying like this :
char as[100]="/usr/sbin/pppd /dev/ttyS0 115200 crtscts debug dump defaultroute usepeerdns noauth connect '/usr/sbin/chat -v "" at+crm=1 OK "atdt#777" CONNECT' mru 254"

sprintf(buffer," %s",as );
system(buffer);

please reply

thanks
amit vermma



Sponsored Link
Ads by Google

Response Number 1
Name: shivu
Date: August 29, 2007 at 02:10:18 Pacific
Reply:

try with the below:

char as[100]="/usr/sbin/pppd /dev/ttyS0 115200 crtscts debug dump defaultroute usepeerdns noauth connect \'/usr/sbin/chat -v \"\" at+crm=1 OK \"atdt#777\" CONNECT\' mru 254"

Here I have prepended scape charecter for each " and '. I have tried the similar type of command in my machine. It is working fine.
I will suggest one more thing. Why you are relying on system library call. You can try with popen call also.


shivakumara K Madegowda


0
Reply to Message Icon

Related Posts

See More


how to install linux on a... Dsl Damn small linux



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: problem in system call in .cpp file

Fonts problem in RH7.3/KDE3 www.computing.net/answers/linux/fonts-problem-in-rh73kde3/13362.html

problem in samba sharing printer www.computing.net/answers/linux/problem-in-samba-sharing-printer/19205.html

Problem with memory mapping in Linux dri www.computing.net/answers/linux/problem-with-memory-mapping-in-linux-dri/5135.html