]> jspc29.x-matter.uni-frankfurt.de Git - daqdata.git/commitdiff
*** empty log message ***
authorhades <hades>
Sun, 10 Sep 2000 09:59:42 +0000 (09:59 +0000)
committerhades <hades>
Sun, 10 Sep 2000 09:59:42 +0000 (09:59 +0000)
allParam/README

index 0ee258066bcde41877f4643194a6f122109008bf..0038c716aa172cfb30996de28712efbad3e62469 100644 (file)
@@ -114,8 +114,8 @@ returned strings may have a length of PARAM_MAX_VALUE_LEN and prepare enought
 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) {
@@ -129,10 +129,10 @@ space for them. Here some examples (one for each function):
        }
 
 /* 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) {
@@ -143,7 +143,7 @@ space for them. Here some examples (one for each function):
        }
 
 /* Param_getStringArray */
-       const char *idx3 = "teststringarray";
+       const char *idx3 = "tstringa";
        char *valuesa[LEN];
        int maxrows = LEN;
        int rows;
@@ -156,7 +156,7 @@ space for them. Here some examples (one for each function):
                }
        }
        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) {
@@ -170,10 +170,10 @@ space for them. Here some examples (one for each function):
        }
 
 /* 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) {
@@ -193,6 +193,14 @@ the exact number of result elements but only a upper limit for that. On the
 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
 ---------------------------------------------------