CrypticKiwi

Can This Be Faster?

4 posts in this topic

#1 ·  Posted (edited)

$Handle = FileOpen("ASCII.txt",16)
$Read = FileRead($Handle)
$NEWFILE = ""
_TOBinary($Read)
Func _TOBinary($Read)
for $i = 1 to StringLen($Read) step 3
    $Mid = StringMid($Read,$i,3)
        if $Mid > 255 Then
            $i -= 1
            $Mid = StringMid($Read,$i,2)
        EndIf
    $NEWFILE &= Chr($Mid)
Next
FileWrite("Binary.txt",$NEWFILE)
EndFunc

Its still running and its more than 3 hours now for a 1mb file...

Edited by CrypticKiwi

Share this post


Link to post
Share on other sites



If you reading as binary you can use BinaryMid instead stringmid. It's faster.

 

Saludos

Share this post


Link to post
Share on other sites

Thanks guys the problem slowing it down was reading the file as binary. its way faster now...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now