mIRC Home    About    Download    Register    News    Help

Print Thread
#87470 18/06/04 09:17 PM
Joined: Dec 2002
Posts: 127
F
feud Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 127
just wondering if anyone knows the max file size that $file() can handle. i have an 8gb backup file that mirc says is 158mb.


------
deep down, i'm really superficial.
#87471 18/06/04 10:58 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
I think it uses an unsigned integer so on a 32 bit system it's going to be 4294967296 bytes (4GB). mIRC has probably wrapped around twice before it came up with 158MB.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#87472 19/06/04 12:11 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
For files of size between 2 and 4GB, $file().size returns a negative number. Having this in mind, one can double the max supported file size: the following alias works correctly with files of up to 4GB (after that it wraps):
Code:
alias filesize1 return $calc($replace($file($1),-,2^32-))
With the help of COM objects, it's possible to make an alias that supports all sizes:
Code:
alias filesize2 {
  if !$isfile($1) { return }
  var %a = fso $+ $ticks, %b = fsize $+ %a
  .comopen %a Scripting.FileSystemObject
  if $comerr { return }
  if $com(%a,GetFile,1,bstr*,$1,dispatch* %b) && $com(%b) {
    .comclose %a $com(%b,Size,2)
    %a = $com(%b).result
    .comclose %b
    return $gettok(%a,1,46)
  }
  .comclose %a
}


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#87473 24/06/04 10:35 PM
Joined: Dec 2002
Posts: 127
F
feud Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 127
thanks


------
deep down, i'm really superficial.
#87474 07/07/04 09:53 PM
Joined: Jun 2003
Posts: 5,024
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Jun 2003
Posts: 5,024
For the sake of anyone browsing this forum etc. I thought I'd post that the file().size limitation has been 'fixed' in mIRC 6.16 smile (See Item 35 of versions.txt)

Regards,


Mentality/Chris

Link Copied to Clipboard