Write Method

Applies to TestComplete 14.72, last modified on January 20, 2021
This method is obsolete. See the Remarks section below.


Use the Write method to write the specified value to a file. The value is written starting from the current position. If the position is not the end of the file, the specified value overwrites the previous data.



aqBinaryFileObj An expression, variable or parameter that specifies a reference to an aqBinaryFile object
Value [in]    Required    Variant    
Result Boolean

Applies To

The method is applied to the following object:


The method has the following parameter:


Defines the variant-compatible value to be written to a file.

Result Value

True if the value was written successfully, and False otherwise.


  • On success, the cursor position is shifted by the length of the written data.

  • To use this method, you should open the needed file with the faWrite or faReadWrite access permission. See the description of the OpenBinaryFile method.

  • This method is obsolete and is not listed in the Code Completion window. It is supported for backward compatibility only. To write a value to a file, use a suitable method of the aqBinaryFile object depending on the type of the value.


The following code writes a character at the end of a binary file. Note that you can specify the character's ASCII code or a string containing this character as the value of the method. The result will be the same.

JavaScript, JScript

function WritingDataToFile()
  MyFile=aqFile.OpenBinaryFile("C:\\MyFiles\\FileName.txt", 10)
  //Writing A to the end of the file


def WritingDataToFile():
  MyFile = aqFile.OpenBinaryFile("C:\\MyFiles\\FileName.txt", 10)
  # Writing A to the end of the file
  # or


sub WritingDataToFile
  Set MyFile=aqFile.OpenBinaryFile("C:\MyFiles\FileName.txt", 10)
  'Writing A to the end of the file
end sub


procedure WritingDataToFile;
var MyFile: OleObject;
  MyFile:=aqFile.OpenBinaryFile('C:\MyFiles\FileName.txt', 10);
  //Writing A to the end of the file

C++Script, C#Script

function WritingDataToFile()
  MyFile=aqFile["OpenBinaryFile"]('C:\MyFiles\FileName.txt', 10);
  //Writing A to the end of the file

See Also

WriteByte Method

Highlight search results