Wicri:Dilib, module Buffer, interface BufferFormat

De Wicri Outils
Révision datée du 1 septembre 2020 à 09:57 par imported>Jacques Ducloy (Code source)

Le type BufferFormat est un outil pour générer des chaînes à partir d'un format (type printf).

Maquette

Code source

/*   -*- coding: utf-8 -*-  */
#include "Buffer.h"
/* a insérer dans Buffer.h */
struct BufferFormatMemoryStruct
{
  char **str;
};

typedef struct BufferFormatMemoryStruct BufferFormatMemory;

/* a créer BufferFormat.o (lib) */

/* zone test  (non regression ? )*/
int main()
{
BufferFormatMemory *mem1;
mem1 = (BufferFormatMemory *) malloc(sizeof(BufferFormatMemory));
mem1->str=(char **)malloc(sizeof(char*)*16*4);  /* char *[4 * 16] ; for 4 liens of ascii char */
mem1->str[1]="foo";
printf("%s\n", mem1->str[1]);
}