X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Cesar Rabak Newsgroups: comp.os.msdos.djgpp Subject: Re: How to copy a file? Date: Sat, 29 Sep 2007 15:43:02 -0300 Organization: Aioe.org NNTP Server Lines: 41 Message-ID: References: NNTP-Posting-Host: qQd7UG1/ctPhtnMYAzFwDg.user.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse AT aioe DOT org In-Reply-To: User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com MikeC escreveu: > wrote in message > news:OF729DCA1D DOT 55951EA7-ON87257360 DOT 006A997C-87257360 DOT 006B1643 AT seagate DOT com... >> "MikeC" wrote on Fri, 21 Sep 2007 00:31:07 GMT: >> >> # Why can't I do it with ... >> # >> # system(string); /* string contains "copy " */ >> # >> # ... as I tried? It compiles OK, and appears to execute when I >> single-step >> # the program under RHIDE, but it takes an instant - not a minute or >> more - >> >> # and the file doesn't get copied. I don't know what I'm doing wrong. >> >> You can. As mentioned, there's no "copy" program - it's trying to >> find "copy.exe" or "copy.com". >> >> That means there's two answers: >> 1) Use XCOPY.EXE >> 2) Invoke the command interpreter: >> system("command.com /c copy ...."); >> >> The second can be a little tricky, because you have to know the name of >> the command interpreter. Go with COMMAND.COM, even though that's not >> what is usually used for a DOS box in 2K/XP. >> > > Thanks a million, Gordon, > > How did you know that xcopy is an embedded command, and that copy is not? > Where do I find this kind of information? > The canonical answer for this is: look at good MS-DOS manual. The 'copy' command is called 'internal' and 'xcopy' is called 'external'. Regards, -- Cesar Rabak