Re: [LAD] OT.C Library for mounting, processing data

From: Markus Schwarzenberg <schwarzb@email-addr-hidden>
Date: Fri Mar 28 2008 - 15:43:31 EET

On Fri, 28 Mar 2008 15:07:21 +0700 Patrick Shirkey <pshirkey@email-addr-hidden> wrote:

> Hi,
>
> Can anyone point me to a library that lets me mount a disk, copy data to
> the disk and unmount the disk?

regarding cp: if you do this in c++, you might want to use

  boost::filesystem::copy_file()

it's very c++ish, (see below) and less platform dependent.
See http://www.boost.org/libs/filesystem/doc/index.htm
There is a lot of nice stuff there ...

Complete example:

Source File: copy_file.cc
  #include <boost/filesystem/operations.hpp>
  int main(void)
  {
    boost::filesystem::path p("file1");
    boost::filesystem::path p2("file2");
    boost::filesystem::copy_file(p, p2);
    return 0;
  }

compile:
% g++ copy_file.cc -l boost_filesystem
  
try out:

% ./a.out
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what(): boost::filesystem::copy_file: "file1", "file2": No such file or directory
Aborted

# OK, create the missing file and try again:
% touch file1
% ls file?
file1
% ./a.out
% ls file?
file1 file2

# Try once more
% ./a.out
terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what(): boost::filesystem::copy_file: "file1", "file2": File exists
Aborted

--
Markus Schwarzenberg
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
Received on Fri Mar 28 16:15:04 2008

This archive was generated by hypermail 2.1.8 : Fri Mar 28 2008 - 16:15:04 EET