Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Copying/Moving files from one dir to other: (4 Items)
   
Copying/Moving files from one dir to other  
Is there any function in QNX to copy files from dir to dir or if any one has implementation in C++ please share.
Re: Copying/Moving files from one dir to other  
> Is there any function in QNX to copy files from dir to dir or if any one > has implementation in C++ please share.


You mean rename() ?

http://www.qnx.com/developers/docs/6.3.2/neutrino/lib_ref/r/rename.html

Jeevan
Re: Copying/Moving files from one dir to other  
> Is there any function in QNX to copy files from dir to dir or if any one has 
> implementation in C++ please share.

There is no standard library function to copy files in QNX or POSIX. In BSD you have copyfile() but that is not present 
in the QNX libs.

The incredibly lazy way is just something like

    system("cp /path1/file1 /path2/file2")

but this depends on the 'cp' utility being present on your target and has very little ability
to detect or handle errors. 

Otherwise you probably need to roll your own. It is not difficult code, but there are a few corner-cases you need to 
take care of. In particular you need to think about the size, ownership and permissions of the file you are copying to, 
especially if you are creating it. I suggest you at least glance over the source code for the command-line cp utility.

Hope that helps.

Rob Rutherford 
Re: Copying/Moving files from one dir to other  
> Is there any function in QNX to copy files from dir to dir or if any one has 
> implementation in C++ please share.


I use Poco::File::copyTo.  Poco is C++ library.