CyRius Posted February 13, 2010 Share Posted February 13, 2010 (edited) I have this code, but FileRead() returns nothing after the page 20+ (or 30+).I think the problem is with the FileSetPos().Helpfile says for FileSetPos():Parameters:handle - A handle to a file previously opened with FileOpen().If i use as FileSetPos(0,$iBufSize * $iPage + 1,$FILE_CURRENT) just works fine. Tell me what is the problem:)$sFileLoc = @ScriptDir & '\Downloads\Movie.avi' $iBufSize = 1024 * 1024 ;=1MB $iMaxPage = Round(FileGetSize($sFileLoc) / $iBufSize) $hFile = FileOpen($sFileLoc,16) For $iPage = 0 To $iMaxPage FileSetPos($hFile,$iBufSize * $iPage + 1,$FILE_CURRENT) $iBuffer = FileRead($hFile,$iBufSize) ConsoleWrite($iPage & '/' & Round(FileGetSize($sFileLoc) / $iBufSize) & ' ' & BinaryLen($iBuffer) & @CRLF) Next FileClose($hFile)Greetz, CyRius Edited February 13, 2010 by CyRius [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
MvGulik Posted February 13, 2010 Share Posted February 13, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
CyRius Posted February 13, 2010 Author Share Posted February 13, 2010 1) Code is incomplete.2) $sFileLoc, that better not contain a location like a folder spec.1) It was incomplete because you must specify a file larger than 150MBs (I've added $sFileLoc)2) I don't understand this. Why shouldn't contain a file location? [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
KaFu Posted February 13, 2010 Share Posted February 13, 2010 This works for me reading and writing a 60 mb jpg sample file: #include <Constants.au3> $sFileLoc = "M101.jpg" $iBufSize = 1024 * 1024 ;=1MB $iBuffer = 0 $iMaxPage = ceiling(FileGetSize($sFileLoc) / $iBufSize) - 1 $hFile = FileOpen($sFileLoc,0) For $iPage = 0 To $iMaxPage FileSetPos($hFile, $iBufSize * $iPage, 0) $iBuffer &= FileRead($hFile, $iBufSize) ConsoleWrite($iPage & '/' & Ceiling(FileGetSize($sFileLoc) / $iBufSize) - 1 & ' ' & BinaryLen($iBuffer) & @CRLF) Next FileClose($hFile) $hFile = FileOpen("test.jpg",1+16) FileWrite($hFile, $iBuffer) FileClose($hFile) OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21)HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
MvGulik Posted February 13, 2010 Share Posted February 13, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
CyRius Posted February 13, 2010 Author Share Posted February 13, 2010 (edited) @MvGulik OK, rename it to $sFolderFileSpec if you can't work with $sFileLoc variable. I just asked you to solve the problem if you can, not to rename my variables, because those not solve the problem (as i see). @KaFu Thanks, your example works well, but my example why didn't work? I will try now your example using binary data. Maybe that causes problems for me. Edit: Oh, i see.. So i must use $FILE_BEGIN instead of $FILE_CURRENT! Edit2: Thank you guys the fast reply:) Edited February 13, 2010 by CyRius [font="Courier New"][size="3"]CyRius Developments[/size][/font][list][*]CO Proxy[*]CO Assembly tool[*]CO PacketSniffer[*]Larkinor proxy[*]BoIM Messenger[*]Encrypt/Decrypt[*]Hashtables[*]Slowest, but greatest skins ever xD[/list] Link to comment Share on other sites More sharing options...
MvGulik Posted February 13, 2010 Share Posted February 13, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
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