开发者

CopyFile() on VxWorks

开发者 https://www.devze.com 2023-02-21 00:17 出处:网络
What is simple API for copy file(s)开发者_StackOverflow on VxWorks (look like a CopyFile() on Windows API)?I assume you are talking about working in the command shell, so the commands may look like:

What is simple API for copy file(s)开发者_StackOverflow on VxWorks (look like a CopyFile() on Windows API)?


I assume you are talking about working in the command shell, so the commands may look like:

-> ls // lists the current directory contents
Myfile1
Myfile2
YourFile2.txt
value = 0 = 0x0          //return status of the ls command - executed w/o errors*

-> copy "Myfile1","/YourDirectory/Myfile1"    // FORMAT: copy "src" , "dest"*
                                              // NB: src & dest argument must be strings*
value = 0 = 0x0                               // return status of copy command.

-> cd "/YourDirectory/"  // change default directory - notice the trailing slash (/)
value = 0 = 0x0          // return status of cd command

-> ls
xyzfile
Myfile1
value = 0 = 0x0

I hope this helps HadziJo


Generally, anything that can be executed at the shell can be called from a program other than the shell.

status = copy("Myfile1", "/YourDirectory/Myfile1");
if (status == OK)  .....

You might look at the man page for xcopy as well depending on the functionality you need.


You can also use "cp" command on cmd shell (vxWorks 6.x), but that is not API, so probably doesn't answer your question exactly.


The best method I found is xcopy("fromPath", "toPath"). It will recursively (including folders and subfolders) copy (duplicate) everything fromPath toPath.

check out the VxWork Manual: http://www.vxdev.com/docs/vx55man/vxworks/ref/usrFsLib.html#xcopy

0

精彩评论

暂无评论...
验证码 换一张
取 消