powershell code: How to get code to its equivalent QM code?
solved. The QM code looks simpler and more elegant.
Macro Macro18
# Read the content of the binary file
$fileContent = [System.IO.File]::ReadAllBytes("$HOME\desktop\a.bin")
# Find and replace specific bytes
for ($i = 0; $i -lt $fileContent.Length - 1; $i++)
{
if ($fileContent[$i] -eq 0x55 -and $fileContent[$i + 1] -eq 0xAA)
{
$fileContent[$i] = 0xFF
$fileContent[$i + 1] = 0xFF
}
}
# Write the modified content back to the file
[System.IO.File]::WriteAllBytes("$HOME\desktop\b.bin", $fileContent)
solved. The QM code looks simpler and more elegant.
Macro Macro18