Uncompress Programming Software Development by Shaabangbang Hello, my prof gave us a problem from the ACM programming contest, we are supposed to write a program that takes a compressed file as input and generates a reproduction of the original uncompressed file as output, the compression scheme requires making a list of the words in the uncompressed file. When a non-alphabetic character is encountered … Re: Uncompress Programming Software Development by iamthwee You need some kinda structure to determine which words have been repeated and such. Has your professor given you any hints cos the scope is massive. Re: Uncompress Programming Software Development by Shaabangbang nope, no tips no nothing.. and yeah, scope is going to be huge, any help would be greatly appriciated! Re: Uncompress Programming Software Development by Lazaro Claiborn [quote=Shaabangbang;321875]Hello, my prof gave us a problem from the ACM programming contest, we are supposed to write a program that takes a compressed file as input and generates a reproduction of the original uncompressed file as output, the compression scheme requires making a list of the words in the uncompressed file. When a non-alphabetic… Re: Uncompress Programming Software Development by Shaabangbang hmm well i was thinking that i make a character array, and its input would be the sentence, and then make an if statement, so it reads and goes through the array, and if one of the characters is an integer, then it would go back in the array that number of times, like lets say we have a sentence "Daniweb is the best and is very helpful" … Re: Uncompress Programming Software Development by Lazaro Claiborn [quote=Shaabangbang;321949]hmm well i was thinking that i make a character array, and its input would be the sentence, and then make an if statement, so it reads and goes through the array, and if one of the characters is an integer, then it would go back in the array that number of times, like lets say we have a sentence "Daniweb is the best … Re: Uncompress Programming Software Development by Shaabangbang Thanks alot Lazaro, i'll give it a shot and keep u guys posted, meanwhile anyone who has a method or knows how to do it please help!!! lol, again any help would be greatly appriciated Re: Uncompress Programming Software Development by Shaabangbang ok guys, im in a bit of pickle here, im still working on the program, its just that, ok its supposed to read the input from a file called input.txt, so the entire paragraph that i showed you in the sample input is in the file input.txt, now im trying to test it first before i start the program, so i used the code : [code] #include <stdio.h> … Re: Uncompress Programming Software Development by John A [URL]http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/gets.html[/URL] [quote][B][inlinecode]gets[/inlinecode] does NOT check the size of the buffer and overflow on the stack can occour.[/B] Because of this, you should use [URL="http://www.phim.unibe.ch/comp_doc/c_manual/C/FUNCTIONS/fgets.html"]fgets[/URL] in preferance.[/quote] So… Re: Uncompress Programming Software Development by Shaabangbang ok, my file name is input.txt, i cant just put it in fgets, it will create an error, like, this is not right : [code] int main () { char line[300]; while (fgets (line, sizeof line, input ) != NULL) { printf ("%s", input); } } [/code] the only reason im using the file input.txt is because my input is a paragraph, so i … Re: Uncompress Programming Software Development by ~s.o.s~ You are getting an error because you are trying to print the "input stream" and not the "character array". In your use of [I]fgets ( ) [/I], "input" is the stream from which you are reading, line by line. [code=c] char buffer [BUFSIZ] = { '\0' } ; while ( fgets (buffer, BUFSIZ, file_stream) != NULL ) { // process… Re: Uncompress Programming Software Development by Shaabangbang ok, im getting everything, and i know how to scan the whole thing now, but how do you print a paragraph in C? are there any built in functions for that or anything? Re: Uncompress Programming Software Development by iamthwee [QUOTE=Shaabangbang;324641]ok, im getting everything, and i know how to scan the whole thing now, but how do you print a paragraph in C? are there any built in functions for that or anything?[/QUOTE] Of course not. Define a paragraph? Re: Uncompress Programming Software Development by Shaabangbang hey, i made some good progress, but i still need your help lol, this is what i got so far [code] #include <stdio.h> #include <ctype.h> #include <string.h> #define WMAX 100 #define WLEN 50 int main(){ char c, word[WMAX][WLEN]; int clet=0, cwor=0, num; int length = strlen (*word); int k; c = getchar(); while (1){ if … Re: Uncompress Programming Software Development by John A >word[WMAX][WLEN] = c; Do you see what you're doing wrong here? Everytime you loop, you assign [INLINECODE]c[/INLINECODE] to the same character -- the last one. Re: Uncompress Programming Software Development by Shaabangbang oh.. well what am i supposed to replace it with then? Re: Uncompress Programming Software Development by John A >oh.. well what am i supposed to replace it with then? Since it looks like you're using [inlinecode]cwor[/inlinecode] and [inlinecode]clet[/inlinecode] as your indices, use them for copying the letter. Re: Uncompress Programming Software Development by Shaabangbang yeah, i did, heres the code segment: [code] c = getchar(); while (c != '0'){ if (isalpha (c)){ word[cwor][clet] = c; c = getchar (); clet++;… Re: Uncompress Programming Software Development by John A The reason that it's breaking after the first word is that in your else {} block you happen to have a [inlinecode]break[/inlinecode] statement, which effectively breaks out of the loop and jumps to the print statement. Re: Uncompress Programming Software Development by Shaabangbang [quote=joeprogrammer;325901]The reason that it's breaking after the first word is that in your else {} block you happen to have a [inlinecode]break[/inlinecode] statement, which effectively breaks out of the loop and jumps to the print statement.[/quote] hmm.. no i tried taking out the break already, it didnt work. The only reason i have the … Re: Uncompress Programming Software Development by John A >The only reason i have the break statement in there is so that it wouldnt plunge into an infinite loop lol Duh. That's what the first break statement is for (the one that checks for a '0'). Each time you encounter a space, however, you should keep going. Otherwise you're only going to read in a single word. Re: Uncompress Programming Software Development by Shaabangbang well yeah but when i remove that break statement, nothing happens when i make an input, it just stays blank. Re: Uncompress Programming Software Development by John A You need to reset [inlinecode]clet[/inlinecode] everytime you start a new word. (Could you also post the updated code, as well as exactly what happens when you type something in?) [edit] Additionally, this line is totally screwed: [code=c]int length = strlen (*word);[/code] length will likely only equal 0 because you haven't put anything into [… Re: Uncompress Programming Software Development by Shaabangbang i dont get it, do you mean i have to put clet = 0; everytime?? anyway heres the updated code: [code=language] #include <stdio.h> #include <ctype.h> #include <string.h> #define WMAX 100 #define WLEN 50 int main(){ char c, word[WMAX][WLEN]; int clet=0, cwor=0, num; int length = strlen (*word); int k; c = getchar();… Re: Uncompress Programming Software Development by John A >do you mean i have to put clet = 0; everytime?? No. Add it [B]where you start a new word[/B]. [code=cplusplus]#include <stdio.h> #include <ctype.h> #include <string.h> #define WMAX 100 #define WLEN 50 int main(){ char c, word[WMAX][WLEN]; int clet=0, cwor=0, num; int length = strlen (*word); // read my … Re: Uncompress Programming Software Development by Shaabangbang ohhhhh, i see, heh, sorry, been working all day, anyways, yeah now it works, only the printing is very strange.. [code=language] #include <stdio.h> #include <ctype.h> #include <string.h> #define WMAX 100 #define WLEN 50 int main(){ char c, word[WMAX][WLEN]; int clet=0, cwor=0, num; int k… Re: Uncompress Programming Software Development by Shaabangbang Nope, Nevermind, got it to work, Thanks a bunch for the help! Re: Uncompress Programming Software Development by Shaabangbang ok, now im trying to find any numbers in the input so that when the program reads the number, it will go back that number of words, example: Daniweb is the best, and 4 very helpful. Now the program will read the 4, and go back 4 words, it will read the word "is" and replace the 4 with it, so the output would be: Daniweb is the best… uncompress gzip file in vb6 Programming Software Development by laoballer Hi all, I'm in need of a way to decompress .gz files that will be downloaded from the NCDC. These Files contain weather information that will be used for some analysis work. My problem is I have a vb6 application and would like to be able to decompress these gzip files. I've done some research and found very limited free alternative. I've only … Re: uncompress gzip file in vb6 Programming Software Development by debasisdas you might to to use some of the compressing/de-compressing agent components for that.