libsc
2.8.7
The SC library provides support for parallel scientific applications.
|
This file declares a simple string object that can be appended to. More...
#include <sc.h>
Go to the source code of this file.
Data Structures | |
struct | sc_string |
This is a simple type for growing a string by printf-like commands. More... | |
Macros | |
#define | SC_STRING_SIZE 4088 |
This defines the maximum string storage including the trailing '\0'. | |
Typedefs | |
typedef struct sc_string | sc_string_t |
This is a simple type for growing a string by printf-like commands. More... | |
Functions | |
void | sc_string_init (sc_string_t *scs) |
Initialize to an empty string. More... | |
int | sc_string_putc (sc_string_t *scs, int c) |
Append a single character to the string buffer object. More... | |
int | sc_string_puts (sc_string_t *scs, const char *s) |
Append a string to the string buffer object. More... | |
int | sc_string_putf (sc_string_t *scs, const char *fmt,...) |
Append to the string object using a format string and arguments. More... | |
int | sc_string_putv (sc_string_t *scs, const char *fmt, va_list ap) |
Append to the string object using a format string and a vararg pointer. More... | |
const char * | sc_string_get_content (sc_string_t *scs, int *length) |
Access content of the string buffer. More... | |
This file declares a simple string object that can be appended to.
typedef struct sc_string sc_string_t |
This is a simple type for growing a string by printf-like commands.
It is public so it can be declared on the stack to avoid malloc and free. This means that the length of the string is limited to SC_STRING_SIZE - 1. The current string can be accessed by sc_string_get_content. This is really an opaque object: its members shall not be accessed directly.
const char* sc_string_get_content | ( | sc_string_t * | scs, |
int * | length | ||
) |
Access content of the string buffer.
[in] | scs | Valid sc_string object. |
[in] | length | If not NULL, assign length without trailing '\0'. |
void sc_string_init | ( | sc_string_t * | scs | ) |
Initialize to an empty string.
This function can be used to reset a non-empty string to be empty again.
[out] | scs | After returning, a valid object containing the empty string. |
int sc_string_putc | ( | sc_string_t * | scs, |
int | c | ||
) |
Append a single character to the string buffer object.
[in,out] | scs | A valid string buffer object. |
[in] | c | Converted to an unsigned char and appended. |
int sc_string_putf | ( | sc_string_t * | scs, |
const char * | fmt, | ||
... | |||
) |
Append to the string object using a format string and arguments.
The maximum length will not be exceeded. The string object will remain valid even on truncated input.
[in,out] | scs | Valid string object that is appended to. |
[in] | fmt | Format string as used with printf and friends. |
int sc_string_puts | ( | sc_string_t * | scs, |
const char * | s | ||
) |
Append a string to the string buffer object.
[in,out] | scs | A valid string buffer object. |
[in] | s | This string is appended to the string buffer. |
int sc_string_putv | ( | sc_string_t * | scs, |
const char * | fmt, | ||
va_list | ap | ||
) |
Append to the string object using a format string and a vararg pointer.
The maximum length will not be exceeded. The string object will remain valid even on truncated input.
[in,out] | scs | Valid string object that is appended to. |
[in] | fmt | Format string as used with printf and friends. |
[in,out] | ap | Argument list pointer as defined in stdarg.h. |