space for them. Here some examples (one for each function):
/* Param_getString */
- const char *name = "testname";
- const char *idx1 = "teststring";
+ const char *name = "tname";
+ const char *idx1 = "tstring";
char values[PARAM_MAX_VALUE_LEN];
int row;
if(Param_getString(param, name, idx1, &row, values) != 0) {
}
/* Param_getInt */
- const char *idx2 = "testint";
+ const char *idx2 = "tint";
unsigned long int valuei;
if(Param_getInt(param, name, idx2, &row, &valuei) != 0) {
- sprintf(stderr, "%s : Param_getString() failed: %s",
+ sprintf(stderr, "%s : Param_getInt() failed: %s",
argv[0], Param_getErrStr(param));
exit (-1);
} else if(row == 0) {
}
/* Param_getStringArray */
- const char *idx3 = "teststringarray";
+ const char *idx3 = "tstringa";
char *valuesa[LEN];
int maxrows = LEN;
int rows;
}
}
if(Param_getStringArray(param, name, idx3, maxrows, &rows, valuesa) != 0) {
- sprintf(stderr, "%s : Param_getString() failed: %s",
+ sprintf(stderr, "%s : Param_getStringArray() failed: %s",
argv[0], Param_getErrStr(param));
exit (-1);
} else if(row == 0) {
}
/* Param_getIntArray */
- const char *idx4 = "testintarray";
+ const char *idx4 = "tinta";
unsigned long int valueia[LEN];
if(Param_getIntArray(param, name, idx4, maxrows, &rows, valueia) != 0) {
- sprintf(stderr, "%s : Param_getString() failed: %s",
+ sprintf(stderr, "%s : Param_getIntArray() failed: %s",
argv[0], Param_getErrStr(param));
exit (-1);
} else if(rows == 0) {
other hand if you want to retrieve an integer array and only one of the
values seems to be no integer (according to strtoul(3)), the return value is
-1 and the content of the supplied array (valueia in our example) is undefined.
+ Take also care of what kind of pointer type you have to supply in the
+different value fields:
+- Param_getString() needs a char *,
+- Param_getInt() needs a unsigned long int *,
+- Param_getStringArray() needs a char** (which is not returned by
+ char valuesa[PARAM_MAX_VALUE_LEN][LEN] !) and
+- Param_getIntArray() needs a unsigned long int *, too (but of course with
+ LEN * sizeof(unsigned long int) allocated memory behind)
4. Known bugs and further developement perspectives
---------------------------------------------------