Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #17422

Re: copying files

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: copying files
Date 2012-02-16 01:34 -0800
Organization None to speak of
Message-ID <lnlio3glzu.fsf@nuthaus.mib.org> (permalink)
References <f62ccd5a-1cf4-4585-b8ca-c515a53d8a73@w9g2000vbv.googlegroups.com>

Show all headers | View raw


Hans Vlems <hvlems@freenet.de> writes:
> I'm maintaing large numbers of Adobe Reader files (.pdf). One of my
> programs, written in C (gcc 4.4.4), must make a copies between
> different filesystems of these pdf files.
> There is AFAIK no library function that does this, which leaves me two
> options:
> 1- use the console interface, i.e. build a command string and pass
> this to system().
> 2- open the file, copy the contents and close the target
> I'd rather avoid option 1 because system runs out of control of my
> program.
> My question is what read and write functions are best suited to copy
> the (binary) pdf files?
> 'Performance is not the main objective, but I want to be sure that the
> copy finished succesfully and accurately.

I'd just invoke the OS's command to copy the files ("cp" on
Unix-like systems, "copy" on Windows, probably something else on
other systems).  It's likely to be at least as fast as anything
you write yourself, and it may preserve metadata (permissions,
etc.) that you're not going to be able to handle in your own code
without considerable difficulty.

I'm not sure why system running "out of control" of your program
should be an issue; can you elaborate?

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 01:03 -0800
  Re: copying files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-02-16 01:23 -0800
    Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 01:31 -0800
      Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 03:14 -0800
        Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 09:43 -0800
          Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 14:59 -0800
            Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 15:06 -0800
    Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 03:13 -0800
      Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 09:56 -0800
        Re: copying files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-02-16 10:11 -0800
          Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 15:11 -0800
            Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 15:21 -0800
              Re: copying files Philip Lantz <prl@canterey.us> - 2012-02-17 09:53 -0800
                Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-18 07:22 -0800
            Re: copying files Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-02-17 03:36 -0800
              Re: copying files Willem <willem@toad.stack.nl> - 2012-02-17 22:04 +0000
                Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-18 07:28 -0800
                Re: copying files Willem <willem@toad.stack.nl> - 2012-02-18 21:28 +0000
              Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-18 07:19 -0800
        Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 15:02 -0800
  Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 01:34 -0800
    Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 03:27 -0800
      Re: copying files Ben Bacarisse <ben.usenet@bsb.me.uk> - 2012-02-16 17:11 +0000
        Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 14:57 -0800
      Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 09:54 -0800
    Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 06:41 -0800
  Re: copying files JohnF <john@please.see.sig.for.email.com> - 2012-02-16 09:49 +0000
    Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 03:10 -0800
      Re: copying files JohnF <john@please.see.sig.for.email.com> - 2012-02-16 11:52 +0000
        Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 06:56 -0800
          Re: copying files David Thompson <dave.thompson2@verizon.net> - 2012-02-24 04:43 -0500
        Re: copying files Ike Naar <ike@iceland.freeshell.org> - 2012-02-16 16:19 +0000
          Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 14:50 -0800
        Re: copying files David Thompson <dave.thompson2@verizon.net> - 2012-02-24 04:43 -0500
  Re: copying files Nobody <nobody@nowhere.com> - 2012-02-16 10:58 +0000
    Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 09:41 -0800
      Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 14:59 -0800
      Re: copying files Nobody <nobody@nowhere.com> - 2012-02-17 06:25 +0000
  Re: copying files Kleuske <kleuske@nowhere.net> - 2012-02-16 11:15 +0000
    Re: copying files Hans Vlems <hvlems@freenet.de> - 2012-02-16 06:45 -0800
    Re: copying files Keith Thompson <kst-u@mib.org> - 2012-02-16 09:49 -0800

csiph-web