PxConfigReadString(), PxConfigReadStringCx()

Read a string parameter from a configuration file

Synopsis:

#include <photon/PxProto.h>

int PxConfigReadString( const char *section,
                        const char *entry,
                        const char *dflt,
                        char *value,
                        short maxlen );

int PxConfigReadStringCx( PxCfgContext_t *cx,
                          const char *section,
                          const char *entry,
                          const char *dflt,
                          char *value,
                          short maxlen );

Arguments:

cx
PxConfigReadStringCx() only. The configuration file handle for the file you want to read from. This handle is returned by PxConfigOpenCx().
section
The section to read a value from.
If section is NULL, the function reads the value from entry in the current section. If section is a valid section name, it becomes the current section.
entry
The entry to read the value from.
dflt
The default to store in value if the specified section or entry don't exist. The first (maxlen-1) characters of the default string are copied (with a '\0' terminator appended).
value
A buffer where the function stores the value it reads.
maxlen
The maximum length of value. PxConfigReadString() copies a maximum of (maxlen-1) characters (with a '\0' terminator appended) in the string into the buffer at address value.

Library:

phexlib

Description:

These functions read a string parameter from the specified section and entry of a configuration file.

PxConfigReadString() reads from the currently open configuration file opened by PxConfigOpen(), while PxConfigReadStringCx() reads from the configuration file indicated by cx.

Returns:

Pt_TRUE if the required section/entry exists, otherwise Pt_FALSE.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PxConfigOpen*(), PxConfigReadBool*(), PxConfigReadChar*(), PxConfigReadDouble*(), PxConfigReadInt*(), PxConfigReadLLong*(), PxConfigReadLong*(), PxConfigReadShort*(), PxConfigWriteBool*(), PxConfigWriteChar*(), PxConfigWriteDouble*(), PxConfigWriteInt*(), PxConfigWriteLLong*(), PxConfigWriteLong*(), PxConfigWriteShort*(), PxConfigWriteString*()