Computing.Net > Forums > Programming > entry level C++ Question..

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

entry level C++ Question..

Reply to Message Icon

Name: buckey
Date: April 12, 2004 at 13:45:15 Pacific
OS: xp
CPU/Ram: 256
Comment:

I am required to make a text file compressor/decompressor for a class I am taking. I am to use the run length algorithm. I have a few ideas on how to accomplish this, but wanted to run it by more seasoned C++ professoinals. If you can make suggesstions on my idea, please feel free to respond. Keep in mind, I am a newbie and want to keep it strait forward. Nothing fancy.

Anyways, I am told I will be given a text file with a header that will contain the number of rows and columns that will need to be compressed. With this in mind, I was thinking that if the header dimensions were 8 by 8, I could have an array with 64 elements, read each line into the array one at a time using getline() or getchar()(don't know which one to use yet, if either). Once array is loaded, traverse through it and count spaces, letters ect.. then implement the algorithm. That is count the number of letters and spaces and represent them with numeric data. For example, if I read aaaaajjj then the output needs to be *5a*3j written to the output file.

Once this is in this compression format, i need to be able to decompress it. That is recreate the original file. So, I will have to read *5a*3j from a file and write aaaaajjj back to an original file.

So, with all that being said, in summary I am going to make a dynamic array, read each line into the array using either getline or getchar and count letters and write them out to a new file in a compressed format. After that, i am going to need to recreate the original file.

Anyway, if anyone out there can give any advice I sure would appreciate it!



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


cd root path Recommended compiler



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: entry level C++ Question..

C++ question(s) www.computing.net/answers/programming/c-questions/8642.html

A few C++ questions www.computing.net/answers/programming/a-few-c-questions/13898.html

IVR DOS level C programming www.computing.net/answers/programming/ivr-dos-level-c-programming/7845.html