Get the next entry in the current section
#include <photon/PxProto.h> const char *PxConfigNextString( char *value, size_t maxlen ); const char *PxConfigNextStringCx( PxCfgContext_t *cx, char *value, size_t maxlen );
phexlib
These functions return the next entry in the current section as a string. A pointer to the entry name is returned, and its configuration value (up to a maximum of maxlen characters including trailing NULL) is copied as a string into the buffer at address value. This may be used to process a configuration section consisting of unknown entries, but where each entry is to be processed in a similar fashion.
If there is no current section (for example, if the file has just been opened), PxConfigNextString*() seeks to the beginning of the first section, and returns the first entry.
A string containing the next entry name within the current section if one exists, NULL otherwise.
If PxConfigNextString*() detects the end of the section, it returns NULL. If you call PxConfigNextString() again, it gets the next entry in the next section. |
char *env, val[128]; if (PxConfigSection("Environment") != NULL) while ((env = PxConfigNextString(val, sizeof(val))) != NULL) setenv(env, val, ~0);
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PxConfigFirstSection*(), PxConfigNextEntry*(), PxConfigNextSection*(), PxConfigOpen*(), PxConfigSection*()