HELP!!!! can't locate the error

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 6
Reputation: dapcigar is an unknown quantity at this point 
Solved Threads: 0
dapcigar's Avatar
dapcigar dapcigar is offline Offline
Newbie Poster

HELP!!!! can't locate the error

 
0
  #1
Oct 14th, 2008
I have an assignment in Modular programming..
Have been able to make the program work... the lil problem am having now is that when i try to load the file i created, it keeps adding the memory location. Moe like it's adding an additional data insead of just loading the initial file.. can anyone help me with this?..
have attached a copy of my assignment to this message.. was trying to zip it but the school server was kinda acting funny..
thanks in Advance


PS: it's written in VC++ 6 so i don't know if it can be a problem for Vc++2008...
Attached Files
File Type: cpp prompt.cpp (516 Bytes, 6 views)
File Type: h prompt.h (247 Bytes, 4 views)
File Type: cpp vcdDB.cpp (2.8 KB, 8 views)
File Type: h vcdDB.h (1.3 KB, 5 views)
File Type: cpp vcdrec.cpp (1.1 KB, 5 views)
File Type: h vcdrec.h (604 Bytes, 5 views)
File Type: cpp vcdmain.cpp (3.5 KB, 5 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,442
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1474
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: HELP!!!! can't locate the error

 
0
  #2
Oct 14th, 2008
1) prompt.h and prompt.cpp -- you need to specify function return values.

2) program is using uninitialized struct member in function Add_vcd(). You can fix that problem by adding a class constructor to the structure which initializes it.
struct vcdDB_T{
       vcdRec_T vcdRecords[maxSize];
       int vcdIndex;
public:
    vcdDB_T() {vcdIndex = 0;} 
};

There appear to be other problems too, such as displaying junk records.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 6
Reputation: dapcigar is an unknown quantity at this point 
Solved Threads: 0
dapcigar's Avatar
dapcigar dapcigar is offline Offline
Newbie Poster

Re: HELP!!!! can't locate the error

 
0
  #3
Oct 14th, 2008
Thanks.. But, When i run the program, my prompt is working fine.. my guess is that am missing something in the vcdDB.h and vcdDB.cpp.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: HELP!!!! can't locate the error

 
0
  #4
Oct 14th, 2008
Well you do use eof() in a control loop, which is bad
http://faq.cprogramming.com/cgi-bin/...&id=1043284351

eof() is a state (the result of a past failure), not a prediction (of a future failure).

That is, if you have a 10 char file and read 10 chars, then eof() will NOT be true. It's only when you try to read (and fail) to read the 11th char that eof() will become true.

The corrollary of all this is that ALL your file read functions should check their return result to see that they succeeded.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC