473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1907
aki wrote:

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

Aug 4 '08 #2
aki
On Aug 4, 5:20 pm, santosh <santosh....@gm ail.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
2350
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
3457
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++ compiler. I need to compile it under UNIX platform. correct? any other alternatives?? Please advise. Thanks!!
5
3547
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 function calls) are part of the (Unix) system calls. The cause of my confusion is that for example stdio.h is considered
6
16392
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 program on UNIX "./pgmname -options Infilename > OutputFilename" * FTP the output of this program back to Windows * Process the resultant file and create output report file
5
1580
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 not "trn", or "archie". Can someone tell me what is the command? Thanks in advance; -Keal
3
3318
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'' which generates a pdf file, and makes life oh so beautiful. Is there a way I can get C++ to tell UNIX to do this without me having to type it in every single time?
3
6919
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 Unix command line. I'd like my PHP code to provide the input text file, run the stand-alone application, and then read the output text file and reformat it for display on the site. Is there a way for my PHP app, to cause this Unix command-line...
0
2053
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 $SQLSTMTset schema ADMIN; I do think that maybe the author types wrongly. I hope you guys can help. Thanks.
0
9484
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10097
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.