String Functions

Libstephen string functions.

Author
Stephen Brennan
Date
Created Friday, 10 July 2015
Copyright
Copyright (c) 2015-2016, Stephen Brennan. Released under the Revised BSD License. See LICENSE.txt for details.

Functions

char* read_file(FILE * f)

Read a file into a string and return a pointer to it.

It is the caller’s responsibility to free() the returned pointer!

Parameters
  • f: The file to read.

wchar_t* read_filew(FILE * f)

Read a file into a wide string and return a pointer to it.

It is the caller’s responsibility to free() the returned pointer!

Parameters
  • f: The file to read.

char* read_line(FILE * file)

Read line from file into string, and return pointer to it.

It is the caller’s responsibility to free() the returned pointer!

Parameters
  • file: File to read line from.

wchar_t* read_linew(FILE * file)

Read line from file into wide string, and return pointer to it.

It is the caller’s responsibility to free() the returned pointer!

Parameters
  • file: File to read line from.

smb_ll* split_lines(char * source)

Return a list of lines from the given string.

The string is modified! You should make a copy before doing this. Also, it is the caller’s responsibility to free the returned list.

Return
A linked list containing char* to each line.
Parameters
  • source: The string to split into lines.

smb_ll* split_linesw(wchar_t * source)

Return a list of lines from the given wide string.

The string is modified! You should make a copy before doing this. Also, it is the caller’s responsibility to free the returned list.

Return
A linked list containing wchar_t* to each line.
Parameters
  • source: The string to split into lines.