From WikiChip
Editing mirc/commands/bwrite

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 1: Line 1:
{{mirc title|/bwrite Command}}
+
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.
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 ==
 
== Synopsis ==
  /bwrite -act <filename> <start_pos> <length> <text|%var|&binvar>
+
  /bwrite <filename> <start_pos> [length] <text|%var|&binvar>
 
+
/bwrite -t <filename> <start_pos> [length] <text|%var>
 
 
'''Note''': If you pass a %var to /bwrite, if the content of that %var is a %variable itself, of if the first token of %var is a %variable itself, the content of %variable is used and no tokenization on %variable occurs, effectively preserving spaces. See the example
 
  
 
== Switches ==
 
== 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.
+
* '''-t''' - Treats everything as plain text (i.e. binary variables are not evaluated)
* '''-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 ==
 
== Parameters ==
 
* '''<filename>''' - the file name to be modified
 
* '''<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.
+
* '''<start_pos>''' - the position in the file to start writing at
* '''[length]''' - Length of the data to be written. Using -1 writes entire length of source text or variable.
+
* '''[length]''' - Length of the data to be written
 
* '''<text|%var|&binvar>''' - data to be written to the file
 
* '''<text|%var|&binvar>''' - data to be written to the file
  
Line 26: Line 19:
 
;Replace "there!" with "world!"
 
;Replace "there!" with "world!"
 
/bwrite file.txt 6 world!</syntaxhighlight>
 
/bwrite file.txt 6 world!</syntaxhighlight>
 
<syntaxhighlight lang="mIRC">
 
//var %b a $chr(32) b | var %a % $+ b | bwrite -c test 0 -1 %a | loadbuf -a test
 
displays "a  b"
 
because the first token in %a is a variable (%b). Adding the -t switch  would have instead written the literal string "%b".
 
</syntaxhighlight>
 
  
 
== Compatibility ==
 
== Compatibility ==
Line 37: Line 24:
  
 
== See also ==
 
== See also ==
 +
* [[List of commands - mIRC|List of commands]]
 +
* [[List of identifiers - mIRC|List of identifiers]]
 
* {{mIRC|$bvar}}
 
* {{mIRC|$bvar}}
* {{mIRC|/bset}}
 
* {{mIRC|/bcopy}}
 
 
* {{mIRC|/bread}}
 
* {{mIRC|/bread}}
 
* {{mIRC|/breplace}}
 
* {{mIRC|/breplace}}
 +
* {{mIRC|/bset}}
 
* {{mIRC|/btrunc}}
 
* {{mIRC|/btrunc}}
 
* {{mIRC|/bunset}}
 
* {{mIRC|/bunset}}
* {{mIRC|$bfind}}
 
 
* {{mIRC|/fwrite}}
 
* {{mIRC|/fwrite}}
 
* {{mIRC|/write}}
 
* {{mIRC|/write}}
* [[List of commands - mIRC|List of commands]]
 
* [[List of identifiers - mIRC|List of identifiers]]
 
 
 
{{mIRC command list}}
 
{{mIRC command list}}
  
[[Category:mIRC commands|bwrite command - mIRC]]
+
[[Category:MIRC commands]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)