WriteInt64 Method

Applies to TestComplete 14.61, last modified on April 22, 2021

Description

The WriteInt64 method writes a long integer value to a binary file.

Declaration

aqBinaryFileObj.WriteInt64()

aqBinaryFileObj An expression, variable or parameter that specifies a reference to an aqBinaryFile object
Result A 64-bit integer

Applies To

The method is applied to the following object:

Result Value

The integer value to write to a file.

Remarks

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

Example

The code below demonstrates how to use the WriteInt64 method.

JavaScript, JScript

function ReadingDataFromBinaryFile()
{
 Path = "C:\\MyFiles\\FileName.txt";
 
 // Creates a new file and opens it for writing in binary mode
 myFile = aqFile.OpenBinaryFile(Path, aqFile.faWrite, true);
 
 // Writes data to the file
  myFile.WriteInt64(2000000000);
 
 // Closes the file
 myFile.Close();
 
 // Opens the file for reading
 myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead);
 
 // Reads data from the file
 Log.Message(myFile.ReadInt64());
  
 // Closes the file
 myFile.Close();
}

Python

def ReadingDataFromBinaryFile():
  Path = "C:\\MyFiles\\FileName.txt"
  # Creates a new file and opens it for writing in binary mode
  myFile = aqFile.OpenBinaryFile(Path, aqFile.faWrite, True)
  # Writes data to the file
  myFile.Write(2000000000)
  # Closes the file
  myFile.Close()
  # Opens the file for reading
  myFile = aqFile.OpenBinaryFile(Path, aqFile.faRead)
  # Reads data from the file 
  Log.Message(myFile.ReadInt64())
  # Closes the file
  myFile.Close()

VBScript

Sub ReadingDataFromBinaryFile
Dim Path, myFile
 'Set Path = "C:\MyFiles\FileName.txt"
 
 ' Creates a new file and opens it for writing in binary mode
 Set myFile = aqFile.OpenBinaryFile("C:\MyFiles\FileName.txt", aqFile.faWrite, true)
 
 ' Writes data to the file
  Call myFile.WriteInt64(2000000000)
 
 ' Closes the file
 Call myFile.Close
 
 ' Opens the file for reading
 Set myFile = aqFile.OpenBinaryFile("C:\MyFiles\FileName.txt", aqFile.faRead)
 
 ' Reads data from the file
  Call Log.Message(aqConvert.IntToStr(myFile.ReadInt64))
 
 ' Closes the file
 Call myFile.Close
End Sub

DelphiScript

procedure ReadingDataFromBinaryFile;
var Path, myFile: OleObject;
begin
 Path := 'C:\MyFiles\FileName.txt';
 
 // Creates a new file and opens it for writing in binary mode
 myFile := aqFile.OpenBinaryFile(Path, aqFile.faWrite, true);
 
 // Writes data to the file
 myFile.WriteInt64(2000000000);
 
 // Closes the file
 myFile.Close;
 
 // Opens the file for reading
 myFile := aqFile.OpenBinaryFile(Path, aqFile.faRead);
 
 // Reads data from the file
 Log.Message(aqConvert.IntToStr(myFile.ReadInt64));
  
 // Closes the file
 myFile.Close;
end;

C++Script, C#Script

function ReadingDataFromBinaryFile()
{
 Path = "C:\\MyFiles\\FileName.txt";
 
 // Creates a new file and opens it for writing in binary mode
 myFile = aqFile["OpenBinaryFile"](Path, aqFile.faWrite, true);
 
 // Writes data to the file
 myFile["WriteInt64"](2000000000);

 // Closes the file
 myFile["Close"]();
 
 // Opens the file for reading
 myFile = aqFile["OpenBinaryFile"](Path, aqFile.faRead);
 
 // Reads data from the file
 Log["Message"]( myFile["ReadInt64"]() );
  
 // Closes the file
 myFile["Close"]();
}

See Also

Working With Files From Scripts
ReadInt64 Method
WriteInt Method
WriteByte Method
WriteBytes Method
WriteShort Method
WriteCurrency Method
WriteFloat Method
WriteString Method
WriteBool Method
WriteDate Method

Highlight search results