jennico Posted March 26, 2007 Posted March 26, 2007 (edited) hi, i just want to give a hint how to speed up the fileread function drastically on large files (e.g. .dat). instead of reading in the whole file you can create a loop reading in just a defined number of characters. the fileread function continues to read in characters beginning with the last character read before +1. for example: you have a large .dat file (several mbs) and you know that you don't need the first 162309 characters, but then you want to analyze the rest of the file in parts of 1024 characters (like splitting a database). instead of reading in the whole file and then splitting it by stringmid() you can do it like that and save a lot of time: $file=FileOpen("test.dat",0) $a=FileRead($file,162309); the first 162309 characters to be ignored While 1 $a=FileRead($file,1024); fileread in steps of 1024 characters ; do what you like to do Wend ; next 1024 characters FileClose($file) Exit in this way i was able to read in, split and rewrite a 5 mb data file within 3 seconds (before 20 minutes). i noticed that this feature is not mentioned in help file. and i am sorry if this hint was mentioned before. j. Edited March 26, 2007 by jennico Spoiler I actively support Wikileaks | Freedom for Julian Assange ! | Defend freedom of speech ! | Fight censorship ! | I will not silence.Don't forget this IP: 213.251.145.96
Zedna Posted April 7, 2007 Posted April 7, 2007 Solution is _APIFileSetPos() --> alias SeekLook here:http://www.autoitscript.com/forum/index.ph...st&p=297390http://www.autoitscript.com/forum/index.ph...PIFileReadWrite Resources UDF ResourcesEx UDF AutoIt Forum Search
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now