1

什么是 VxWorks 上用于复制文件的简单 API(看起来像 Windows API 上的 CopyFile())?

4

4 回答 4

4

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

于 2011-03-30T15:44:04.820 回答
1

通常,可以在 shell 中执行的任何内容都可以从 shell 以外的程序中调用。

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

根据您需要的功能,您也可以查看手册页xcopy

于 2011-04-01T15:10:18.843 回答
0

您也可以在 cmd shell (vxWorks 6.x) 上使用“cp”命令,但这不是 API,因此可能无法准确回答您的问题。

于 2016-08-04T13:47:33.073 回答
0

我发现最好的方法是xcopy("fromPath", "toPath"). 它将递归(包括文件夹和子文件夹)复制(复制)从路径到路径的所有内容。

查看 VxWork 手册:http ://www.vxdev.com/docs/vx55man/vxworks/ref/usrFsLib.html#xcopy

于 2016-12-15T09:28:53.240 回答