how to define my own error node

hello, everyone
i want to define my own error code,what should i do?
thank you!

What kind of error code? If you mean a number other than EXIT_SUCCESS or EXIT_FAILURE returned from main(), just return another number that you’ve decided on a meaning for, i.e. return 3245 to mean ‘no disk space left’ or something like that.

pheraps you mean the error code as a compiler directive (e.g. “#error MY OWN ERROR CODE”)?

Or you want to extend errno?

yes, i want to extend errno

You cannot.

You can lookup in the header file /usr/include/errno.h and start your own errno above that of the highest number, but that still won’t make function like strerror work.

Usually what I end up doing is try to reuse some of the errno that already exists. If that doesn’t work you can provide your own version of strerror() for example that works on top of the real strerror()

thank you. i will do it with other method