tags:

views:

37

answers:

1

If I use Dos command "copy" to concatenate two files:

copy a1.txt + a2.txt a.txt

I will have something like the following in stdout:

C:\a1.txt
C:\a2.txt
   1 file(s) copied.

I do not want to have anything written in stdout, I mean, I just want to have 'a.txt' without those 3 lines written in stdout. Is there any way to do so? the reason is, I need speed and I know that any IO takes time.

Thanks, Shadi.

+2  A: 

Redirect output to nul: copy a1.txt+a2.txt a.txt > nul.

PiotrLegnica
In the case of `copy`, you should probably use the `/Y` switch to suppress the question of whether to overwrite the destination file. Otherwise, the command will just hang waiting for a response to a question that nobody can see.
Rob Kennedy
Thanks.Actually I am using "system" to call "copy" in my C++ program. when I added '> nul' to the end of the command, It did not work properly. the "system" function returned "1" and did not create "a.txt".
Shadi
@Shadi: what OS are you writing for exactly?
PiotrLegnica
I am writing code in Visual Studio.NET 2008 in windows.
Shadi
Thanks, it works now :)
Shadi