From WikiChip
mirc/file handling
< mirc
Revision as of 09:43, 19 September 2014 by Ouims (talk | contribs) (Created page with "'''File Handling''' allows you to manipulate files on disk using seperate, simple operations. This allows for efficiency. To understand how it works, you must be familiar wit...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

File Handling allows you to manipulate files on disk using seperate, simple operations. This allows for efficiency.

To understand how it works, you must be familiar with text file operations such as /write and $read.

Let's take a looke at /write, /write is powerful tool which allows you to write to a file according to severals predefined options.

A simple "/write filename.txt line" involves the following file handling operations:

  • /fopen
  • /fseek
  • /fwrite
  • /fclose

/fopen

/fopen [-nox] <name> <filename>

/fopen opens the filename and use the specified name to reference it. The command fail by default if the file does not exists, the -n switch create the file if it does not exist, fails if it exists. The -o switch create a new file if it does not exist but overwrite the file if it exists.

After you opened a file with /fopen, you have a pointer of the content of the file, it starts at 0. This pointer is the starting position to read/write from.

/fseek

/fseek -lnwr <name> <position>

/fseek sets the read/write pointer to the specified <position in the file, unless you use a switch:

  • -l -