Hi all, need some advice I’m writing a program in c. And its objectives would be; 1. Monitor error code occurrences, 2. Deleting Instance in the DB and having a graceful exit. And writing this program in UNIX environment I’ve been searching for some samples thorough, and suggestion?

Recommended Answers

All 4 Replies

you need to be a little more specific -- monitor error code occurrences about what? delete instances of what in what DB? Your description is way too brief to be of much value.

error code >0 occurences, I'll assume that may error code would be place into a variable then this var would be err. If this value greater than zero their should have exception handling. Then another condition for it would be it delete a specific entry to a table and succefully exit the program.

>>If this value greater than zero their should have exception handling
I don't think there is a way to listen for errors like that. The program would have to be coded on function-per-function basis. Each time a function is called check its return value for error condition. And C language does not support C++ style exception handling. In C language the best you can do is use a series of setjmp() and longjmp() or check function return values.

Deleting a specific entry in a DB table is not much of a problem if you know SQL and use ODBC or the database's specific language. ODBC is pretty portable to all databases. You have to know user name, password, table name, table structure, and key field value of the row you want to delete. Of course the user name you supply must have permission to do the deletions (not everyone is allowed to do that).

Yes thanks that was one of my jeopardy. C had no exception handling rather than c++. On the other hand I was creating a function to a components that had some defect from what I said above.

The pseudocode is already identified its the next way is to code it up.

Thanks again for the idea.

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.