在 WinCC 中如何把文件从一个位置拷贝到另一个位置 ?

描述:
可以在动作中把文件从一个位置拷贝到另一个位置。 可以使用函数 CopyFileA 来拷贝文件。该函数需要 pragma (切换编译属性)。

Sample C script:
#pragma code (“kernel32.dll”)
BOOL CopyFileA(LPCTSTR,LPCTSTR,BOOL);
#pragma code ()

char source[255] = “F:examplesourcedata.txt”;
char destination[255] = “F:destinationdata.txt”;

CopyFileA( source , destination , FALSE );

CopyFileA

In the example

Explanation

Parameter 1

source

源文件(包含路径)

Parameter 2

destination

目标文件(包含路径)

Parameter 3

FALSE

FALSE : 覆盖现有文件
TRUE : 不覆盖现有文件

Table 1: CopyFileA 参数

注意事项:
必须使用字符串 “” 作为路径标示。

在WinCC 6.2 SP2 和WinCC 7.0通过测试。

原创文章,作者:ximenziask,如若转载,请注明出处:https://www.zhaoplc.com/plc334391.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2020年11月5日
下一篇 2021年4月12日

相关推荐

发表回复

登录后才能评论