[LC++]file copying
larry
larry at twistedpop.com
Wed Jan 28 10:56:02 UTC 2004
I have a problem related to the speed of copying files in C++ on linux. I need to automate a process to copy files from one directory to another for media management. Anyway, the following code is what I have been using and it is not nearly fast enough. The entire focus of this application is speed. In fact in Windows, I am getting at least 5 times the speed from a VB app that I am using. I know I must be doing something wrong. I am compiling on a one processor machine and moving it to the test equipment which has four processors and 4 gigs or RAM. I wonder should I compile it there to see if it runs better or is there a better method for copying files from one directory to another. The file system is Reiserfs on a gentoo installation. The machine that I am compiling on is ext3 on Redhat.
IPFile = fopen("/home/this.jpg","r");
OPFile = fopen("/mediafiles/this.jpg","w");
while ((c = fgetc(IPFile)) != EOF)
{
fputc(c, OPFile);
}
fclose(IPFile);
fclose(OPFile);
Anyway, I am at a loss. There has to be a better method than this. Thanks.
---
Larry Lines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20040128/10f7258a/attachment.htm
More information about the tuxCPProgramming
mailing list