>  Docs Center  >  Using IDL  >  Choosing an Error Code

Choosing an Error Code

Choosing an Error Code

The choice of which code to use depends on the context in which the message is issued, but IDL_M_NAMED_GENERIC is usually preferred.

Note: For any significant development involving an IDL system routine, we recommend your code be packaged as a Dynamically Loadable Module (DLM), and that your DLM define a message block to contain its errors instead of using the GENERIC messages described here.

To include arguments into your message string, use the sprintf() function from the C standard library to format a string into a temporary buffer, and then supply the buffer as the argument to IDL_Message(). For example, executing the code:

char buf[128];
int unit = 23;
sprintf(buf, "Help! Error number %d.", unit);

interrupts the current routine and issues the message:

% Help! Error number 23.

© 2020 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us