pranav0091 Posted March 6, 2011 Share Posted March 6, 2011 I was toying around with AutoIt using it for simple automation until I got an assignment, which was basically to implement some data compression scheme and to comment on the compression ratio etc.I have never done any project like this-which gives a finished product-on any programming language, though I'm decently conversed with C++ and a little bit with AutoIt.So this time around I thought of using AutoIt for implementing the Lempel-Ziv algorithm. I got the code ready and it compiled okay, but the output wasn't what I expected. Then as a part of trouble shooting i got the generated code table and found that except for the first one, there's only one type of code - equivalent to the ASCII of "O".Can anybody tell me where I'm going wrong ?I looked around a lot, but cant figure out why I'm not able to generate different codes. So i'm attaching the code. Any help is appreciated. Lempel_Ziv.au3Note: The code for the algorithm itself is not "complete" in the sense that a few exceptions have not been covered yet.Thanks in advance. Link to comment Share on other sites More sharing options...
BrewManNH Posted March 7, 2011 Share Posted March 7, 2011 I haven't tested the code, but looking through it, you have made an incorrect assumption in regards to FileRead. FileRead($ipfile, 1) reads in one CHARACTER, not one bit. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
pranav0091 Posted March 7, 2011 Author Share Posted March 7, 2011 I haven't tested the code, but looking through it, you have made an incorrect assumption in regards to FileRead. FileRead($ipfile, 1) reads in one CHARACTER, not one bit.Thanks for pointing out the mistake. Is there some way I can get the script to read the file bit by bit instead of reading one byte at a time? Link to comment Share on other sites More sharing options...
MvGulik Posted March 7, 2011 Share Posted March 7, 2011 Is there some way I can get the script to read the file bit by bit instead of reading one byte at a time?No. A Byte is the minimum data size for FileRead().- You will need to use additional code to get at the bits of a Byte. (Give forum search a try, as there are some topics on that subject.) "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