Gromacs  2018.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
#include <cstdio>
#include "gromacs/utility/basedefinitions.h"
+ Include dependency graph for strdb.h:

Description

Declares C functions for reading files with a list of strings.

Functions

gmx_bool get_a_line (FILE *fp, char line[], int n)
 Reads a line of at most n characters from *fp to line. More...
 
gmx_bool get_header (char line[], char header[])
 Read a header between '[' and ']' from line to header. More...
 
int get_lines (const char *db, char ***strings)
 Opens file db, or if non-existant file $GMXLIB/db and read strings. More...
 
int search_str (int nstr, char **str, char *key)
 Searches an array of strings for key, return the index if found. More...
 

Function Documentation

gmx_bool get_a_line ( FILE *  fp,
char  line[],
int  n 
)

Reads a line of at most n characters from *fp to line.

Comment ';...' and leading spaces are removed, empty lines are skipped. Return FALSE when eof.

gmx_bool get_header ( char  line[],
char  header[] 
)

Read a header between '[' and ']' from line to header.

Returns FALSE if no header is found.

int get_lines ( const char *  db,
char ***  strings 
)

Opens file db, or if non-existant file $GMXLIB/db and read strings.

First line in the file needs to specify the number of strings following. Returns the number of strings.

int search_str ( int  nstr,
char **  str,
char *  key 
)

Searches an array of strings for key, return the index if found.

Returns -1 if not found.