/* Include the standard C i/o library */ #include #include #include /* Include wavevars structure definition */ #include "wavevars.h" /* Begin actual C function. */ char * linknload_sample2(int argc, char ** argv) { /* Declare miscellaneous local variables. */ int i, j, msgnum; int result, result2, nvars; int found = 0; float *dataptr; char **names; char *msg; WaveVariable *vars; /* Now show how to call wavevars to access PV-WAVE CL * variables directly. */ result = wavevars (&nvars, &names, &vars); if (result == 0) { printf ("Bad return value from wavevars! \n"); return ("Bad return value from wavevars! \n"); } /* Search through the names list returned from wavevars, * for the PV-WAVE CL variable named wmainfltvar. */ for (i = 0; i < nvars; i++) { result2 = strcmp("PVDATA", names[i]); if (result2 == 0) { WaveVariable *v = &vars[i]; found = 1; /* Get the pointer to the actual data. */ dataptr = ((float *) v->data); /* Assign new values to array. */ for (j = 0; j < v->numelems; j++) { dataptr[j] = (float) j; } break; } } /* End for ... */ /* Return String message to PV-WAVE */ msgnum=50; msg = (char *)malloc(sizeof(char)*msgnum); strcpy(msg, "Return value is STRING!!"); return (msg); } /* End of program. */