TORCS  1.3.10
The Open Racing Car Simulator
Loading...
Searching...
No Matches
string_utils.cpp File Reference
#include <learning/string_utils.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <portability.h>
Include dependency graph for string_utils.cpp:

Go to the source code of this file.

Macros

#define INIT_MSG_LEN   100

Functions

char * strBaseName (char *filename)
 Returns the name of a file without leading pathname.
char * strRemoveSuffix (char *filename, char c)
 Returns a fresh copy of the name of a file without suffix.
char * strConcat (int n,...)
 Returns the concatenation n strings.
void message (const char *msg,...)
 Prints a message.
StringBuffer * read_string (FILE *f, StringBuffer *s)
 Reads a string dynamically.
StringBuffer * SetStringBufferLength (StringBuffer *s, unsigned int l)
StringBuffer * NewStringBuffer (int length)
 Make a new stringbuffer.
void FreeStringBuffer (StringBuffer **s)
 Given a pointer to a stringbuffer pointer, free it and clear it.
char * string_copy (char *c)
 copies a string

Variables

static char msgbuf [10000]
static FILE * msgport = stderr

Macro Definition Documentation

◆ INIT_MSG_LEN

#define INIT_MSG_LEN   100

Definition at line 87 of file string_utils.cpp.

Function Documentation

◆ FreeStringBuffer()

void FreeStringBuffer ( StringBuffer ** s)

Given a pointer to a stringbuffer pointer, free it and clear it.

Definition at line 156 of file string_utils.cpp.

◆ message()

void message ( const char * msg,
... )

Prints a message.

Definition at line 78 of file string_utils.cpp.

◆ NewStringBuffer()

StringBuffer * NewStringBuffer ( int length)

Make a new stringbuffer.

Definition at line 143 of file string_utils.cpp.

Here is the call graph for this function:

◆ read_string()

StringBuffer * read_string ( FILE * f,
StringBuffer * s )

Reads a string dynamically.

Definition at line 93 of file string_utils.cpp.

Here is the call graph for this function:

◆ SetStringBufferLength()

StringBuffer * SetStringBufferLength ( StringBuffer * s,
unsigned int l )

Definition at line 130 of file string_utils.cpp.

Here is the call graph for this function:

◆ strBaseName()

char * strBaseName ( char * filename)

Returns the name of a file without leading pathname.

(It's not a new string, but a pointer in the given string)

Definition at line 25 of file string_utils.cpp.

◆ strConcat()

char * strConcat ( int n,
... )

Returns the concatenation n strings.

The strings are the parameters given after n You have to free the memory!

Definition at line 49 of file string_utils.cpp.

◆ string_copy()

char * string_copy ( char * c)

copies a string

Definition at line 165 of file string_utils.cpp.

◆ strRemoveSuffix()

char * strRemoveSuffix ( char * filename,
char c = '.' )

Returns a fresh copy of the name of a file without suffix.

(Trailing chars after c) You have to free the memory!

Definition at line 30 of file string_utils.cpp.

Variable Documentation

◆ msgbuf

char msgbuf[10000]
static

Definition at line 22 of file string_utils.cpp.

◆ msgport

FILE* msgport = stderr
static

Definition at line 23 of file string_utils.cpp.