473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Unix "system " command

aki
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"<<omcid<<endl; // here i printed the value it
iscoming correct
cout<<"netype"<<netype<<endl;// here also
cout<<"nename"<<nename<<endl; // here also
system( ("rm -f /path/" + omcid + '_' + netype + '_' + nename
+"_*_trans.csv").c_str() ) ;

thanks
aki
Aug 4 '08 #1
3 1879
aki wrote:

<news:comp.lang.c++>
<news:comp.unix.programmer>

Aug 4 '08 #2
aki
On Aug 4, 5:20 pm, santosh <santosh....@gmail.comwrote:
aki wrote:

<news:comp.lang.c++>
<news:comp.unix.programmer>
it was due to inccorrect path ...
now i is working fine..

thanks
Aki
Aug 4 '08 #3
aki wrote:
Hello ,

i want to use system commnad in my code to delete files in specified
manner.
Your subject header and this sentence are both incorrect. system() is a
C function, not a command, and certainly not a "Unix command".
but this way i am not able to delete files.
Use the C remove function. Surely this is in any elementary C textbook.

#include <stdio.h>
int remove(const char *filename); /* returns 0 for success, nonzero
otherwise */

If you don't have a standard C compiler, you could try the unix system
function unlink(). If you do that, remember that it is non-standard,
making your program not portable and making any enquiries about it
off-topic here.

You also need to find out what language you are using.
Lines like
string omcid;
contain an undefined identifier 'string' in C, unless you have defined
it somewhere. If you have, show it to us; don't make us guess what it
means,

and things like
cout<<"omcid"<<omcid<<endl; // here i printed the value it
iscoming correct
have a number of problems. 'cout' and 'endl' are undefined in C, left
shifting by a string constant has no meaning, and the '//' style comment
has, as you can see, resulted in a broken line with the nonsensical line
of code 'incoming correct' as a result.

It appears that you have no idea what language you are using, or what
functionality is available in it.
Aug 4 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hans Deragon | last post by:
Greetings. I am performing: commands.getstatusoutput("rsync <params>"); rsync takes a long time and prints out a steady stream of lines showing which file it is currently working on.
12
by: jrefactors | last post by:
If the C programs have UNIX system calls such as fork(), alarm(), etc.., we should call it UNIX programs, not traditional C programs? We couldn't compile the programs with system calls using VC++...
5
by: markus | last post by:
Hi, I have a question that deals with the standard c library VS (Unix) system calls. The question is: which header files (and functions) are part of the C library and which header files (and...
6
by: Joseph | last post by:
Hi, I am trying to develop a C# application that will run on Windows that will do the following * Select file name to process * FTP the file to a UNIX server * Process this file on UNIX using a...
5
by: Jonay Aloat | last post by:
I know that I can use the news group to post questions. But last time, one of my friend show me that you can do the same thing using a unix command. I don't remember the command, but I know it is...
3
BenTheMan
by: BenTheMan | last post by:
Ok---I was wondering...Is there any way to make C++ execute a UNIX command? Like, I generate LaTeX files in my code, file.tex. Then I need to compile the .tex files with ``pdflatex file.tex''...
3
by: Vik Rubenfeld | last post by:
I'm developing a web site in PHP for an Apache server. I have a particular stand-alone application that takes a text file as input, and produces a text-file as output. It's usually run from the...
0
by: teckguan | last post by:
Hi everyone, I would like to ask how am I going to execute multiple scripts using UNIX command? I have found a command to execute. However, I cannot execute it. The command is db2 -txf <<EOF...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.