Re: unix system command
- From: James Kanze <james.kanze@xxxxxxxxx>
- Date: Sun, 26 Oct 2008 03:12:56 -0700 (PDT)
On Oct 24, 12:15 pm, aki <akhileshrawat...@xxxxxxxxx> wrote:
I want to use system command in my code to run below commands
in system.
1)mkdir -p /alcatel/var/share/AFTR/BSC;
2) mount -F lofs /alcatel/var/share/AFTR/BSC /var/sftp/bscsftp/
BSC
3) echo "/alcatel/var/share/AFTR/BSC - /var/sftp/bscsftp/
BSC lofs - yes -" >> /etc/vfstab
How can i do this ...
i performed like this
long status1 =system( ("mkdir -p /var/sftp/bscsftp/BSC").c_str() ) ;
error is :
const char* is not a structure type.
how to do this..can sombody help ???
Well, you have a char const[], which converts implicitly to the
char const* required by system. You could always write
system( std::string( "mkdir -p /var/sftp/bscsftp/BSC").c_str() ) ;
but quite frankly, I don't see any point of it. Use std::string
and its member function c_str() when you have to build up the
command string; just use string literals directly.
Also third command need some special synatax i guess...any
idea..
Why? The system function normally invokes a shell with "-c"
your_string, so all of the usual shell operators are there.
I've executed pipelines in system, and I've used it to start
processes in background, as well as redirecting input and
output.
--
James Kanze (GABI Software) email:james.kanze@xxxxxxxxx
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
.
- Follow-Ups:
- Re: unix system command
- From: aki
- Re: unix system command
- References:
- unix system command
- From: aki
- unix system command
- Prev by Date: Re: flex: doubt regarding the meaning of some character classes
- Next by Date: Re: about code sinnept in APUE Chapter 11 about thread
- Previous by thread: Re: unix system command
- Next by thread: Re: unix system command
- Index(es):
Relevant Pages
|