473,508 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie question

10 New Member
Hello all,

Im currently writing a small program that will be invoked has a scheduled task to back up all of the files froma directory on my C drive toa removable disk (F).

I've tried using the following;

system("copy c:\test\*.* f:\");

(which is basically what I did at the command prompt to achieve the same thing)

However when run the program runs it reports that the syntax of the command is incorrect

Any one seen this before or know why?

Nathan
Aug 3 '07 #1
4 1285
JosAH
11,448 Recognized Expert MVP
Hello all,

Im currently writing a small program that will be invoked has a scheduled task to back up all of the files froma directory on my C drive toa removable disk (F).

I've tried using the following;

system("copy c:\test\*.* f:\");

(which is basically what I did at the command prompt to achieve the same thing)

However when run the program runs it reports that the syntax of the command is incorrect

Any one seen this before or know why?

Nathan
A backslash character in a literal string is special to the compiler, e.g. \n
means a new line character and there are more of them. Since the backslash
character is a special character by itself you need *two* of them to have
*one* of them in your literal string, so:

Expand|Select|Wrap|Line Numbers
  1. system("copy c:\\test\\*.*  f:\\");
  2.  
kind regards,

Jos
Aug 3 '07 #2
thenath24
10 New Member
A backslash character in a literal string is special to the compiler, e.g. \n
means a new line character and there are more of them. Since the backslash
character is a special character by itself you need *two* of them to have
*one* of them in your literal string, so:

Expand|Select|Wrap|Line Numbers
  1. system("copy c:\\test\\*.*  f:\\");
  2.  
kind regards,

Jos
Thanks Jo that worked a treat :-)

Nathan
Aug 4 '07 #3
Firecore
114 New Member
so does that mean that we can use system(); to use dos based commands?
Aug 5 '07 #4
JosAH
11,448 Recognized Expert MVP
so does that mean that we can use system(); to use dos based commands?
You've got it. Here's a nice reference web page for C/C++:

C/C++ library reference; bookmark the url.

kind regards,

Jos
Aug 5 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1565
by: Elger | last post by:
Dear Members, A newbie question How do I convert this XML example into HTML (using XSLT)? <DOCUMENT> <PARA> This <BOLD>is</BOLD> a <BOLD>test</BOLD> </PARA> </DOCUMENT>
4
1056
by: DragonLord | last post by:
I have a custom user control that i am trying to understand and it has numbers before the line items. So here it comes the real newbie question What the heck are the numbers for?? 205: For...
5
2488
by: kamikaze04 | last post by:
Hello. I have a very newbie question about Streams. The situation is that i have a function (that i cannot modify it's definition/call): public void F1(istream & in){ while( ...) { ...
5
1132
by: Banibrata Dutta | last post by:
Hi, I've gone through the list of "language differences" between 2.3 / 2.4 & 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very...
16
1856
by: Raxit | last post by:
Hi, i was reading/learning some hello world program in python. I think its very simillar to Java/C++/C#. What's different (except syntax) ? what can i do easily with python which is not easy...
7
1502
by: idiolect | last post by:
Hi all - Sorry to plague you with another newbie question from a lurker. Hopefully, this will be simple. I have a list full of RGB pixel values read from an image. I want to test each RGB band...
5
2681
by: Randall | last post by:
I am a newbie trying to learn the DOM. Can someone tell me why the first alert statement returns null, and the second returns the value 33px (which was set using the style="top:33px;" in the DIV...
12
1815
by: Philipp.Weissenbacher | last post by:
Hi all! This is most certainly a total newbie question, but why doesn't the following code cause a segfault? void insertion_sort(int a, int length) { int i; for (i=0; i < length; i++) { int...
3
2333
Lokean
by: Lokean | last post by:
Sorry for this newbie question, this is not my realm of expertese. I have searched google, tried several applications that claim they can do this, such as Mapforce, which I found confusing, to...
5
1391
by: Dave | last post by:
I am new to Visual Web Developer 2005 Expres. I am using absolute positioning and every time I add a button control to my web form its width extends all the way to the edge of the page. IOW I...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7118
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
7323
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,...
0
7493
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...
0
5625
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4706
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1550
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 ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.