Unix "system " command - Unix

This is a discussion on Unix "system " command - Unix ; Hello , i want to use system commnad in my code to delete files in specified manner. but this way i am not able to delete files. Can somebody answer . i tried with this as following , but not ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Unix "system " command

  1. Unix "system " command

    Hello ,

    i want to use system commnad in my code to delete files in specified
    manner.
    but this way i am not able to delete files.
    Can somebody answer .

    i tried with this as following , but not working
    string omcid;
    string netype ;
    string nename ;

    //some stuff to get values inside these string variables

    cout<<"omcid"< iscoming correct
    cout<<"netype"< cout<<"nename"< system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
    +"_*_trans.csv").c_str() ) ;

    thanks
    aki

  2. Re: Unix "system " command

    On Aug 4, 5:43 pm, aki wrote:
    > Hello ,
    >
    > i want to use system commnad in my code to delete files in specified
    > manner.
    > but this way i am not able to delete files.
    > Can somebody answer .
    >
    > i tried with this as following , but not working
    > string omcid;
    > string netype ;
    > string nename ;
    >
    > //some stuff to get values inside these string variables
    >
    > cout<<"omcid"< > iscoming correct
    > cout<<"netype"< > cout<<"nename"< > system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
    > +"_*_trans.csv").c_str() ) ;
    >
    > thanks
    > aki


    it was due to inccorrect path ...
    now it is working fine..

    thanks
    Aki

  3. Re: Unix "system " command

    On Aug 4, 2:43*pm, aki wrote:
    > * * * * system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
    > +"_*_trans.csv").c_str() ) ;


    Consider using unlink() or remove().

  4. Re: Unix "system " command

    Sjoerd wrote:
    > On Aug 4, 2:43*pm, aki wrote:
    > > * * * * system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
    > > +"_*_trans.csv").c_str() ) ;


    > Consider using unlink() or remove().


    But that would not work with the wildcards in the file name, for
    that the OP needs a shell to do the expansion...

    Regards, Jens
    --
    \ Jens Thoms Toerring ___ jt@toerring.de
    \__________________________ http://toerring.de

  5. Re: Unix "system " command

    In article <6fqqs5Fctv2bU1@mid.uni-berlin.de>,
    jt@toerring.de (Jens Thoms Toerring) wrote:

    > Sjoerd wrote:
    > > On Aug 4, 2:43*pm, aki wrote:
    > > > * * * * system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
    > > > +"_*_trans.csv").c_str() ) ;

    >
    > > Consider using unlink() or remove().

    >
    > But that would not work with the wildcards in the file name, for
    > that the OP needs a shell to do the expansion...


    Consider using glob().

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

+ Reply to Thread