![]() |
|
#1
|
|||
|
|||
Debugging problem....Hi everybody.
I really got stuck into a number of problems with my code. Namely, I am trying to debug this portion of code but whatever I have tried I could not fix it. If you have some ideas please let me know, I'd appreciate a lot. I've already lost so many hours. Thank you. CPP / C++ / C Code:
Last edited by dsmith : 02-Aug-2004 at 08:21.
Reason: Please use [c] & [/c] for syntax highlighting
|
|||
|
#2
|
||||
|
||||
|
Quote:
Welcome to GID, Max. We'll do what we can. Initially though, I'd suggest (since you asked) 1) use code tags as the sticky post mentions. Unformatted code is almost impossible to read... 2) Post the relevant sections of the code. Trying to understand 263 lines of mostly undocumented code is probably not on most people's list of things to do. We don't even have an idea what you are trying to accomplish in this code... 3) Stating you have a number of problems then asking us to figure out what those problems are, then come up with the solution, is also not a good plan. Please give us an idea of what the code is supposed to do, what is wrong, where you think the problem is, and post the section of code you think is responsible with enough detail that we don't have to guess. With that, we almost always can help you solve anything... __________________
During the election they said Obama could only be elected when pigs fly. Well, we currently have an epidemic of Swine Flu. Coincidence? |
|
#3
|
|||
|
|||
|
The program is run by following command:
program.c stopWords file1 where stopWords file contains all words that are likely to appear in some text file so many times, those words are: will, no, yes, an, on, big, wont, etc. so the program compares words from file1 with those in the stopWords and generates a new file that contains all words that appear in file 1 but not in stopWords. Words are sorted alphabetically in the newly created file in the following style: word nameOfTheFileWordOriginatesFrom NumberOfOccurances Now i've got some requirements, and they are: If a file fails to open for reading or writing, the program must print corresponding error message (shown in the program) to standard error, and free all the memory that has been dynamically allocated so far, and exit the program with exit(1). If memory allocation fails because there is not enough memory available, you must print the string "not enough memory" followed by a newline character to standard error, free all the memory that has been dynamically allocated (if any) and exit the program with exit(1). All memory dynamically allocated must be freed before the program terminates. You can assume that a stop word or a word in the input text file contains at most 20 alphabetical letters. THANK YOU A LOT! |
|
#4
|
|||
|
|||
|
So: what works for you, and what doesn't work?
Have you actually compiled the program? What compiler? It has an error that prevents successful compilation. Show us your compiler output. Dave |
|
#5
|
|||
|
|||
|
I'm using GCC, I get
Code:
Tracking: CPP / C++ / C Code:
UR gonna kick your self. You're attempting to assign 0 into a function in your if statement. i.e. You should have == instead of =. Your compliler should have choked on this & failed. I've not tested the program, it simply compiles for me now. GF |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C I/O problem | kelly80 | C Programming Language | 4 | 27-Apr-2004 21:15 |
| Another FX 5600 problem (but with details that might shed light on this) | BobDaDuck | Computer Hardware Forum | 2 | 16-Apr-2004 08:53 |
| problem with php5 cgi installation | fab13 | Apache Web Server Forum | 3 | 19-Nov-2003 10:11 |
| unwanted scrollbar problem | kelly001 | Web Design Forum | 3 | 24-Oct-2003 11:44 |
| join problem | zuzupus | MySQL / PHP Forum | 0 | 14-Aug-2003 06:11 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The