Up | Previous | Next | Title Page | Contents

5.3 Examples

When using the “vparm” routines to get parameter input from the user, you should always look at the count field, never the def field, to see if a value has been entered. But if there are no values, the return value is not necessarily touched... you're guaranteed "count" valid values but that might be 0.
To allow for all possible cases, use this test:
   if (count == 0 || strlen(value) == 0)
This protects against null input. The user could enter a null value, in which case count is 1 but the value is empty.

Up | Previous | Next | Title Page | Contents