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

Patrick Shirkey pshirkey at boosthardware.com
Fri Mar 28 19:10:43 UTC 2008


Markus Schwarzenberg wrote:
> On Fri, 28 Mar 2008 15:07:21 +0700 Patrick Shirkey <pshirkey at boosthardware.com> 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()
>
>   

Thanks. This is quite a good selection so far.

I wonder why nothing relevant shows up for me with google?

It's all webpages talking about how to mount a device from CLI...


Cheers.

> 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 at lists.linuxaudio.org
> http://lists.linuxaudio.org/mailman/listinfo/linux-audio-dev
>   


-- 
Patrick Shirkey
Boost Hardware Ltd.






More information about the Linux-audio-dev mailing list