mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2004
Posts: 19
Q
Pikka bird
OP Offline
Pikka bird
Q
Joined: Jun 2004
Posts: 19
I am writing an addon for my webserver (programmed in mIRC lol) that will basically draw a chart on a webpage, given various points/formulas...

In the process the script generates a datafile with the following contents:

[c:\graph.dat]
1
320
1
1
320
1
320
320

This is fine, however when I go to read it, mIRC acts strangely. If I were to do an //echo -s $read(graph.dat,1), the 2nd line is returned. By the same token, if I were to do $read(graph.dat,0) it reads the first line - which is usually not the case smirk. Of course, if I try to read the last line, //echo -s $read(graph.dat,8), I get an error. Why is the count starting at 0? All other files I've ever used start at $read(file,1)

I've tried several different files, and even different versions of mIRC (I have the latest, 6.2 btw), and the same problem is produced.

(I posted this under the scripts section because I'm not 100% sure that it is actually a 'bug').

Please get back to me soon.
Thanks in advance, Qb_Master.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you read the help file about $read, you will notice this note:

Quote:
If the first line in the file is a number, it must represent the total number of lines in the file. If you specify N = 0, mIRC returns the value of the first line if it's a number.

If the t switch is specified then mIRC will treat the first line in the file as plain text, even if it is a number.


So, use $read(filename.txt,t,1) and you'll get the first line, even if it's a number.


Invision Support
#Invision on irc.irchighway.net
Joined: Jun 2004
Posts: 19
Q
Pikka bird
OP Offline
Pikka bird
Q
Joined: Jun 2004
Posts: 19
Thanks, I accidentally skipped over that line, found out a few hours later lol. Thanks for the help smile


Link Copied to Clipboard