-
Copying exe file
I have a program that copies a file to another.... it uses the fstream functions... It works fine when i copy text files but when i try to copy exe's or other files the copied file is corrupt.. I even tried the ios::binary mode.. But it still does not work.. I think the problem is i copy character by character till end of file(EOF) is encountred.. Since the exe's may have -1 some where in between it terminates there.. this is my guess.... So how do i make the prog work.....
Thanx
Vasanth
-
At a point like that I would resort to using API calls to read files.
-
Well i am not using VC++ or anything.. I am using TC++ (turbo c++) which only supports 16 bit DOS applications..
-
You should try to get the real size of the file. Then don't read until EOF but until you have read the correct size. that way you can copy the eof char to.