首页 文章

VxWorks上的CopyFile()

提问于
浏览
1

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

4 回答

  • 0

    我假设您正在讨论在命令shell中工作,因此命令可能如下所示:

    -> 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

  • 1

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

  • 0

    我找到的最好的方法是 xcopy("fromPath", "toPath") . 它将以递归方式(包括文件夹和子文件夹)复制(复制)从Path到Path的所有内容 .

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

  • 3

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

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

    根据您需要的功能,您可能会查看 man page 以获取 xcopy .

相关问题