O'Reilly logo

APIs at Work, Second Edition by Ron Hawkins, Doug Pence, Bruce Vining

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

More on Error-Handling

Now let’s go back to the QUSBPRV = 0; statement. Quite often, you will want your program to continue running even if an error is found by the API. For instance, you might want to handle an incorrect job queue name by prompting the user for the correct job queue name. How could you change the sample program in Figure 2.2.C so that an incorrect job queue name wouldn’t cause the program to end? The answer is simple: set QUSBPRV to a nonzero value. QUSBPRV tells the API how many bytes the program has allocated for error-related information. A value of zero indicates that no storage is available, so the API sends an escape message. A value of eight or more informs the API that the API caller wants error information returned ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required