[Previous] [Contents] [Index] [Next]


Write a string parameter in a configuration file


#include <photon/PxProto.h>

int PxConfigWriteString( const char *section, 
                         const char *entry, 
                         int format, 
                         const char *value );


PxConfigWriteString() writes a string parameter in the specified section and entry of the configuration file. If section is NULL, the parameter is written in the specified entry in the current section. If the parameter value was present in the file, it's overwritten with its new value; otherwise, it's added to the end of the section.

  • The configuration file must have been opened by PxConfigOpen() with a mode of PXCONFIG_WRITE.
  • If the specified section doesn't exist, it's created.
  • To create an empty section, call PxConfigForceEmptySection().

The format parameter must be PXCONFIG_FMT_STRING and the string must not contain a \n.

You can write a single comment line in the section by specifying "#" for entry and the comment for value. For example:

PxConfigWriteString( "My section", "#", PXCONFIG_FMT_STRING,
                     "This is a comment");


Pt_TRUE if the entry is written, otherwise Pt_FALSE



Interrupt handler No
Signal handler No
Thread No

See also:

PxConfigOpen(), PxConfigReadBool(), PxConfigReadChar(), PxConfigReadInt(), PxConfigReadLong(), PxConfigReadShort(), PxConfigReadString(), PxConfigWriteBool(), PxConfigWriteChar(), PxConfigWriteInt(), PxConfigWriteLong(), PxConfigWriteShort()

[Previous] [Contents] [Index] [Next]