ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/FileAccess/WriteAllBytes
The command writes a byte array to a file.
In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:
VAR
bFileAccessWriteAllBytes : BOOL;
OutputDataFileAccessWriteAllBytes : ST_VoidOutputData;
hrFileAccessWriteAllBytes : HRESULT;
fbFileAccess : FB_FileAccess;
END_VAR
hrFileAccessWriteAllBytes := fbFileAccess.WriteAllBytes(
bExecute := bFileAccessWriteAllBytes,
ConnectionHandle := depragSmartConnection.ConnectionHandle,
sfullPathSourceFile := 'C:\Test\text.txt',
BytesToWrite := testShortByteArray,
nNumberOfBytesToWrite := 4,
OutputData => OutputDataFileAccessWriteAllBytes);
IF hrFileAccessWriteAllBytes <> S_FALSE THEN
bFileAccessWriteAllBytes := FALSE;
END_IF
For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".