Home Download Change log

Introduction

String handling in standard C is a painful thing. Handling lists of strings is another painful thing. This small C library combine the strings library and the lists library to offer simply to use string list functions.

Features

Examples

#include <stdlib.h>
#include <assert.h>

#include "global.h"
#include "stringlists.h"
#include "strings.h"

int main(int argc, char *argv[])
{
  StringList stringList;
  String     s,t;
  StringNode *stringNode;

  StringList_init(&stringList);

  s = String_new();

  String_setCString(s,"Hello");
  StringList_append(&stringList,s);

  String_setChar(s,' ');
  StringList_append(&stringList,s);

  String_setCString(s,"World!");
  StringList_append(&stringList,s);

  STRINGLIST_ITERATE(&stringList,stringNode,t)
  {
    printf("%s",String_cString(t));
  }

  String_delete(s);
  StringList_done(&stringList);

  return 0;
}

Compile

Sorry, there is no makefile, but compilation is simple:
    
gcc -c stringlists.c
gcc -c strings.c -DHAVE_LONG_LONG
gcc -c lists.c
gcc -c global.c
gcc -c stringlists_demo.c
gcc -o stringlists_demo stringlists_demo.o strings.o lists.o global.o stringlists.o -lpthread
Please note:

License

Stringlist library is currently under GPL version 2.

Download

stringlists-0.03.tar.bz2

ChangeLog

2012-07-07 0.03
  * updated included lists library

2012-05-06 0.02
  * renamed StringList_empty() -> StringList_isEmpty()
  * clean-up

2010-12-17 0.01
  * initial public release
      

    
Back to top