Difference between revisions of "Fseek"

From Scriptwiki
Jump to: navigation, search
Line 18: Line 18:
 
|}
 
|}
  
 +
'''Note''' that mIRC will internally set the pointer to byte 0 and scan for <linenumber> - 1 CR/LF combinations when using the -l switch.
  
 
== Example ==
 
== Example ==

Revision as of 01:11, 23 December 2005

Sets the read/write pointer to the specified position in the file.

/fseek <name> <position>


The following switches can also be used to move the file pointer:

Switch Meaning
l /fseek -l <name> <linenumber>. Moves the pointer to the begin of the specified line.
n /fseek -n <name>. Moves the pointer to the begin of the next line.
w /fseek -w <name> <wildcard>. Moves the pointer to the next occurrence of a string matching this wildcard from the current position of the pointer (see example below).
r /fseek -r <name> <regex>. Moves the pointer to the next occurrence of a string matching the regex.

Note that mIRC will internally set the pointer to byte 0 and scan for <linenumber> - 1 CR/LF combinations when using the -l switch.

Example

Let's imagine with have the following file "moo.txt" in our mircdir:

This is my first line containing moo!
This is just a senseless text file.
mooooo
thats the end.
moo?

We have opened this file using /fopen moo moo.txt


/fseek -l moo 2

This example would set the position of the pointer to the begin of the second line (infront of This is just a senseless text file.).


/fseek -n moo

This example would set the pointer to the begin of the next line (infront of 'mooooo').


/fseek -w moo moo*

This example would move the pointer to the next occurrence of the word moo* after line three (that is line 5, moo? in our example file).


/fseek -w moo moo*

Now, this command would fail, as there is no other string containing moo after line 5.