[comp.sys.ibm.pc.programmer] using "system" in C

jono@dec06.cs.monash.edu.au (Jonathan Oliver) (04/04/91)

I am writing a rather large program (about 550K) in C and I recently
noticed that when I called "system" in the following way

	system("copy file1 file2");

there was not enough memory to perform the copy.
Is there a way of copying files that doesn't require as much memory.
Thanks in advance
	Jon Oliver

forget@pluton (Yves Forget) (04/05/91)

In article <jono.670739550@dec06> jono@dec06.cs.monash.edu.au (Jonathan Oliver) writes:
>I am writing a rather large program (about 550K) in C and I recently
>noticed that when I called "system" in the following way
>
>	system("copy file1 file2");
>
>there was not enough memory to perform the copy.
>Is there a way of copying files that doesn't require as much memory.

If your program is so big, you may want to compile with size 
optimization (I know you can do that with Turbo C, but I didn't use it
too much, and I can't tell you how efficient it is).

Another way would be to have your program to copy the files, or,
depending on the context, you may want to generate a batch file that
will do the copy.

I think the better way is to use overlays.  If you have problems with
the system function (although you must know that the function loads a
(second) copy of command.com in memory), you may have problems generating
your code soon.  So you may have to think about overlays, or maybe buying
more memory...

Hope this helps

Yves

=======================================================================
Yves Forget                    forget at terre.dmi.usherb.ca (Internet)
Universite de Sherbrooke       bo05   at udesvm.bitnet (bitnet address)
-- 
=======================================================================
Yves Forget                    forget at terre.dmi.usherb.ca (Internet)
Universite de Sherbrooke       bo05   at udesvm.bitnet (bitnet address)