![]() |
| ||
| txt files in pascal Hi to all, I have this homework with Pascal. We have a text file that has some text in it (thetext.txt). we want to put all the words of the text and the frequency in another file without repeating the word(file name finalfile.txt). Example: thetext.txt has this text in it: the quick brown fox jumps over a big brown bear that was sleeping on a big brown board. this is how the finalfile should look. finalfile.txt: the 1 quick 1 brown 3 fox 1 jumps 1 over 1 a 2 big 2 bear 1 that 1 was 1 sleeping 1 on 1 board 1 ------------------------------- I tried to solve this exercise this way. 1st we read the thetext.txt letter one by one and merge them in a string. than use a linked list to keep the word and the frequency. If for instance one of the words is in the list than we raise the frequency by one otherwise we add the word to the list and set the frequency to one. at the end we write all the elements of the list in the finalfile.txt and we're done. BUT when i run the program i wrote it just gets stuck! i am pasting the code so you'll see what i wrote. Please if anyone can help me in finding the bug, i would really appreciate that. Have a nice weekend :D Program DenduridheFjale; |
| ||
| Re: txt files in pascal guys sorry, thetext.txt = tekst.txt finalfile.txt= fjaleden.txt |
| ||
| Re: txt files in pascal Quote:
Procedure Kontrollo_listen(Var l:fjale;fj2:str);You cannot call dispose after have allocated memory that you still will use - You will use than until your program has finished. So, you will need to write a procedure in order to free allocated memory at end of your program - don't forget it. Bye |
| All times are GMT -4. The time now is 11:40 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC