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...

Recommended Answers

All 3 Replies

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.

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.

Well you do use eof() in a control loop, which is bad
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046476070&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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.