Open a configuration file
#include <photon/PxProto.h> int PxConfigOpen( const char *cfgfile, int mode);
PxConfigOpen() opens the configuration file specified by cfgfile for reading. The file should be closed using PxConfigClose() when the configuration procedure is complete. Only one configuration file may be opened at any one time.
The mode parameter is a bitfield specifying what operations may be performed on the configuration file; it consists of any number of the following values:
The configuration file consists of simple text and is divided into sections, introduced by [section_name]. Section names are currently limited to 50 characters. Each section is made up of entries (one per line) of the form:
entry_name = value
Entry names are currently limited to 64 characters. Values are limited to 512 characters. Comments follow #, anywhere on a line. Here's an example:
[WWW Section] Heading Font = swiss Body Font = dutch Link Color = 0000FF Visited Color = 008080 Cache Size = 10240 [File Section] File Font = swiss12 Print Command = lp @ Display Mode = 1
See PxConfigSection() for further details on the configuration.
if (PxConfigOpen(fname, PXCONFIG_READ)) { // read parameters from the file PxConfigClose(); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PxConfigClose(), PxConfigDeleteEntry(), PxConfigDeleteSection(), PxConfigForceEmptySection(), PxConfigNextSection(), PxConfigNextString(), PxConfigReadBool(), PxConfigReadChar(), PxConfigReadInt(), PxConfigReadLong(), PxConfigReadShort(), PxConfigReadString(), PxConfigSection(), PxConfigWriteBool(), PxConfigWriteChar(), PxConfigWriteInt(), PxConfigWriteLong(), PxConfigWriteShort(), PxConfigWriteString()