| _CP_read | Index Level | _CP_readt |
| Syntax | int _CP_readnext(CPSTR** result, int* list, int* value, int expression) |
| Category | C Interface |
| Type | C Function |
| Description |
equivalent to the FlashBASIC statement: readnext result,value from list
If expression is non-zero, then the "secondary" list is assumed. The _CP_readnext call must be proceeded by a _CP_select call or a _CP_execute call which produces an external select list. In the case of an external list generated by a _CP_execute, the user should pass a pointer to an int containing -1 as the list parameter when readnext is first called. This function returns -1 if an error occurs. The error code is contained in _CP_errno. This situation occurs when there are no more items in the list. In this case, _CP_errno will contain PE_END_LIST. |
| Options | |
| See Also | C Functions introduction |
| Example |
The following example prints the first file name in the current account.
CPSTR * s = _CP_mkstr("select md with a1 \"d]\" sampling 1"); CPSTR * id = _CP_str_null; int sl = -1; _CP_execute(_CP_EXECUTE, s, (CPSTR**) 0, (CPSTR**) 0); _CP_readnext(&id, &sl, (int*) 0, 0); _CP_print(id); The following example prints the item names in "myfile". CPSTR * n = _CP_mkstr("myfile"); CPSTR * id = _CP_str_null; int sl = -1; int f = -1; _CP_open(&f, _CP_str_null, n); _CP_select(f, &sl, 0); while (_CP_readnext(&id, &sl, (int*) 0, 0) >= 0) _CP_print(id); |
| Warnings | When possible, the user should use _CP_select on a file rather than a _CP_execute of a TCL "select" command as the _CP_select call is much more efficient. |
| Compatibility | AP 6.1 |
| _CP_read | Index Level | _CP_readt |