Functions | |
void | nextLine (FILE *fp) |
Read from file until a newline. | |
void | nextInput (FILE *fp) |
Read from file until next input line is ready (i.e. next line not starting with a comment sign '#'). | |
char * | getNextToken (char *ptr) |
Read until a new token. | |
char * | terminateToken (char *ptr) |
Terminate the current token with a null byte. | |
long long | getLong (char **buf) |
Get a long value. | |
double | getDouble (char **buf) |
Get a double value. | |
char * | getString (char **buf) |
Get a string value. | |
void | stringCopy (const char *source, char *dest, int n) |
Copies a string. | |
int | stringCmpQ (const char *s1, const char *s2) |
Compares two strings, but at maximum until one string ends. | |
void | removeTrailingNewline (char *s) |
removes a trailing newline from a string, if there is one | |
void | minMaxD (double *arr, size_t size, double *mini, double *maxi) |
return the minimum and maximum from an array of double's | |
void | minMaxT (time_t *arr, size_t size, time_t *mini, time_t *maxi) |
return the minimum and maximum from an array of time_t's | |
char * | findChr (char *str, size_t len, char chr) |
Find the character chr in the string str. |
void nextLine | ( | FILE * | fp | ) |
Read from file until a newline.
fp | Pointer to the FILE structure |
void nextInput | ( | FILE * | fp | ) |
Read from file until next input line is ready (i.e. next line not starting with a comment sign '#').
fp | Pointer to the FILE structure |
char* getNextToken | ( | char * | ptr | ) |
Read until a new token.
A token is a word, a number or a string, seperated by spaces or tabs. This function is intended for parsing data files, etc.
ptr | Pointer to a string |
char* terminateToken | ( | char * | ptr | ) |
Terminate the current token with a null byte.
ptr | Pointer to a string, pointing to the start of a token |
long long getLong | ( | char ** | buf | ) |
Get a long value.
Searches for the next token in a string, converts it to a long long and returns its value. The parameter buf will be changed so that (*buf) points to the end of the returned token.
buf | Pointer to a pointer to a string |
double getDouble | ( | char ** | buf | ) |
Get a double value.
Searches for the next token in a string, converts it to a double and returns its value. The parameter buf will be changed so that (*buf) points to the end of the returned token.
buf | Pointer to a pointer to a string |
char* getString | ( | char ** | buf | ) |
Get a string value.
Searches for the next token in a string, and returns its value. The parameter buf will be changed so that (*buf) points to the end of the returned token.
buf | Pointer to a pointer to a string |
void stringCopy | ( | const char * | source, | |
char * | dest, | |||
int | n | |||
) |
Copies a string.
Copy a string, but copy n bytes maximum Terminate dest string with null byte
source | Source string | |
dest | Destination string | |
n | maximum number of bytes to copy |
int stringCmpQ | ( | const char * | s1, | |
const char * | s2 | |||
) |
Compares two strings, but at maximum until one string ends.
s1 | The first string | |
s2 | The second string |
void removeTrailingNewline | ( | char * | s | ) |
removes a trailing newline from a string, if there is one
s | The string |
void minMaxD | ( | double * | arr, | |
size_t | size, | |||
double * | mini, | |||
double * | maxi | |||
) |
return the minimum and maximum from an array of double's
arr | An array of double | |
size | The size of the array | |
mini | Returns the minimal value of arr | |
maxi | Returns the maximal value of arr |
void minMaxT | ( | time_t * | arr, | |
size_t | size, | |||
time_t * | mini, | |||
time_t * | maxi | |||
) |
return the minimum and maximum from an array of time_t's
arr | An array of unsigned long | |
size | The size of the array | |
mini | Returns the minimal value of arr | |
maxi | Returns the maximal value of arr |
char* findChr | ( | char * | str, | |
size_t | len, | |||
char | chr | |||
) |
Find the character chr in the string str.
str | An array of char | |
len | The size of the array | |
chr | The character which is to be found |
Generated by![]() |
|