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?

Re: Error Code Handling Inquiry 80 80

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.

Re: Error Code Handling Inquiry 80 80

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.

Re: Error Code Handling Inquiry 80 80

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

Re: Error Code Handling Inquiry 80 80

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 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.