gabriel rosenkoetter on Wed, 19 Jun 2002 23:18:53 -0400 |
On Wed, Jun 19, 2002 at 10:10:19PM -0400, ian reinhart geiser wrote: > ifstream in("sourcefile"); > ofstream out("destfile"); > string s = ""; > while (getline(in,s)) > out << s << "\n"; That's all well and good, but in the real (OS) world, we mmap(2) a reasonable window of a file in order to copy it, then write that (pretty much however you like, though the less the function hides from you the less likely it's wasting time), then move the window. See: http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/basesrc/bin/cp/utils.c?rev=1.20&content-type=text/plain (especially copy_file()). All that we've been discussing here are quick hacks. If Fred's really writing an installer, he'd do well to go learn about mmap(2). Ian, isn't this how KDE's file interaction stuff works (when it's interacting with a local file)? Or does it really use C++ streams? (Hope your local standard C++ library dtrt, in that case, or you're way slower than you need to be.) -- gabriel rosenkoetter gr@eclipsed.net Attachment:
pgppTufwCbSX5.pgp
|
|