Re: [Siglinux] Copy

2002-08-01 Thread Jason Smith
Said Chris Heintzelman on Thu, Aug 01, 2002 at 02:04:00PM -0500, > Interesting. Could you post a code snippet? Great idea. I did some tests and I quickly realized that I was absolutely incorrect. Furthermore, I don't even know what I was thinking when I posted, since the kernel totally does the

Re: [Siglinux] Copy

2002-08-01 Thread Chris Heintzelman
Interesting. Could you post a code snippet? >d Doug McLaren on Thu, Aug 01, 2002 at 01:58:52AM -0500, > > >>As others have suggested, basically you'll just do this -- >> >> open input >> open output >> malloc a small buffer (1 KB is good but might be slow, 1 MB might >> be perfect,

Re: [Siglinux] Copy

2002-08-01 Thread Jason Smith
Said Doug McLaren on Thu, Aug 01, 2002 at 01:58:52AM -0500, > As others have suggested, basically you'll just do this -- > >open input >open output >malloc a small buffer (1 KB is good but might be slow, 1 MB might > be perfect, depending on free ram, 1 GB is a bit large :) >

Re: [Siglinux] Copy

2002-08-01 Thread Doug McLaren
On Tue, Jul 30, 2002 at 06:16:43PM -0500, Alexander Boulgakov wrote: | Duh. Also, this is open source. Check the sourcecode for cp (you can | find the source at www.gnu.org). The source code for cp is likely to just confuse anybody who needs to ask for code to do a simple copy :) After all, it

Re: [Siglinux] Copy

2002-07-30 Thread Alex Winbow
On Tue, 30 Jul 2002, Chris Heintzelman wrote: > Good point, although isn't 1 gig a bit much to malloc? > > size_t BUFSIZE=1024*1024*1024; Umm, no. [looking nervously other way] ___ Siglinux mailing list [EMAIL PROTECTED] http://www.utacm

Re: [Siglinux] Copy

2002-07-30 Thread Chris Heintzelman
Good point, although isn't 1 gig a bit much to malloc? Alex Winbow wrote: >>Showoff! >> >> > You wouldn't want to use this to copy anything very big. Also, if >the file size changes during copying, the extra is not copied. > > Would it not be better to allocate a nice, fixed buff

Re: [Siglinux] Copy

2002-07-30 Thread Alex Winbow
> Showoff! You wouldn't want to use this to copy anything very big. Also, if the file size changes during copying, the extra is not copied. Would it not be better to allocate a nice, fixed buffer size, then copy the file in chunks right up to the end? eg, size_t

Re: [Siglinux] Copy

2002-07-30 Thread Alexander Boulgakov
Showoff! Chris Heintzelman wrote: > try this > > > int copy(const char* srcfn, const char* dstfn) > { >struct stat stats; >unsigned size; >FILE* srcfd; >FILE* dstfd; >int ret; >char* buf; > >ret = stat(srcfn,&stats); > >if(ret<0) { printf("Error getting file si

Re: [Siglinux] Copy

2002-07-30 Thread Chris Heintzelman
try this int copy(const char* srcfn, const char* dstfn) { struct stat stats; unsigned size; FILE* srcfd; FILE* dstfd; int ret; char* buf; ret = stat(srcfn,&stats); if(ret<0) { printf("Error getting file size: %s\n",strerror(errno)); return errno; } size =

Re: [Siglinux] Copy

2002-07-30 Thread Alexander Boulgakov
Duh. Also, this is open source. Check the sourcecode for cp (you can find the source at www.gnu.org). Alex Alexander Boulgakov wrote: > Vohra, Yasin wrote: > > Hello: > > > > Is there a function that actually makes a copy of the file in C ? > > If yes please let me know. > > > > T

Re: [Siglinux] Copy

2002-07-30 Thread Alexander Boulgakov
Vohra, Yasin wrote: > Hello: > > Is there a function that actually makes a copy of the file in C ? > If yes please let me know. > > Thanking you - Yasin > > > > ** > This email and any files transmitted with it fr

[Siglinux] Copy

2002-07-30 Thread Vohra, Yasin
Hello: Is there a function that actually makes a copy of the file in C ? If yes please let me know. Thanking you - Yasin ** This email and any files transmitted with it from the ElPaso Corporation are confidentia