Teledyne-lecroy Verification Script Engine (VSE) Manual Uživatelský manuál Strana 94

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 115
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 93
Teledyne LeCroy Verification Script Engine Reference Manual
Page 94 of 115
19.4 Write()
This function writes data to the file.
Format: Write(file_handle, value, num_of_bytes)
Parameters:
file_handle "handle" to the file previously opened by OpenFile()
value Data to write
num_of_bytes Optional parameter specifying how many bytes to take from the
value parameter (if omitted, length is calculated automatically
based on the value type)
Remarks:
This function is primarily for binary files. It can be used for text files only if the value parameter is a string of text.
In that case, it is equivalent to the WriteString() function and the num_of_bytes parameter is ignored.
Example:
set BinFile = 0;
BinFile = OpenFile("C:\\data.bin", 0, _FO_BINARY);
# Write a string to the binary file.
Write(BinFile, "All we need is love!!!");
# Write a substring ("All") to the binary file.
Write(BinFile, "All we need is love!!!", 3);
val = 0xBEEF;
Write(BinFile, val); # Writes integer = (EF BE 00 00) to the binary file.
Write(BinFile, val, 2); # Writes WORD = (EF BE) to the binary file.
# Write a byte chain to the binary file.
Write(BinFile, 'AABBCCDDEEFF12345678');
# Write a list of values to the binary file.
Write(BinFile, [ 0xAA, "USB", 12, 0xBEEF ]);
CloseFile(BinFile); # Closes the binary file.
Zobrazit stránku 93
1 2 ... 89 90 91 92 93 94 95 96 97 98 99 ... 114 115

Komentáře k této Příručce

Žádné komentáře