From WikiChip
/bwrite Command - mIRC
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
The /bwrite command can be used to write a specified amount of bytes from the string/buffer to a given file starting at the start_pos position.
Note: the starting position is 0, not 1.
Synopsis
/bwrite -act <filename> <start_pos> <length> <text|%var|&binvar>
Switches
- -t - Treats everything as plain text (i.e. $identifiers and %variables (but not contents of %variables) are evaluated, but binary variables are not evaluated, are treated as text strings beginning with &) This switch is needed if literal string begins with & or string within %var begins with & or % characters.
- -c - Chops the file at the end of the written data (if your current disk file is 10 bytes and you write 3 bytes at position 3 (4th byte), the resulting disk file's filesize is 6 because the 3 bytes were written as the 4th through 6th bytes of the file)
- -a - Disables UTF-8 encoding of characters in the range 0-255, as long as the line contains no characters > 255
Parameters
- <filename> - the file name to be modified
- <start_pos> - the position in the file to start writing at. First byte of the file is 0. Using -1 appends data to the end of existing file.
- [length] - Length of the data to be written. Using -1 writes entire length of source text or variable.
- <text|%var|&binvar> - data to be written to the file
Example
;Write some text to a file at beginning of the file /bwrite file.txt 0 hello there! ;Replace "there!" with "world!" /bwrite file.txt 6 world!
//var %b contents of b | var %a $chr(37) $+ b | echo -a a= %a b= %b | bwrite -c test.dat 0 -1 %a | echo -a file= $read(test.dat,nt,1) returns: test because the contents of %a began with % causing the contents of %b to be written. Using -tc instead of -c would have written the literal string %b instead.
Compatibility
Added: mIRC v5.3
Added on: 13 Dec 1997
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.
See also
mIRC commands list