944,007 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 444
  • C++ RSS
Oct 14th, 2008
0

HELP!!!! can't locate the error

Expand Post »
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


Quote ...
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, 8 views)
File Type: h prompt.h (247 Bytes, 6 views)
File Type: cpp vcdDB.cpp (2.8 KB, 11 views)
File Type: h vcdDB.h (1.3 KB, 8 views)
File Type: cpp vcdrec.cpp (1.1 KB, 8 views)
File Type: h vcdrec.h (604 Bytes, 7 views)
File Type: cpp vcdmain.cpp (3.5 KB, 8 views)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dapcigar is offline Offline
6 posts
since Jul 2008
Oct 14th, 2008
0

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

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,953 posts
since Aug 2005
Oct 14th, 2008
0

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

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
dapcigar is offline Offline
6 posts
since Jul 2008
Oct 14th, 2008
0

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

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: struct
Next Thread in C++ Forum Timeline: OpenGL in C++





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC