Présentation
Documentation
L'équipe
Sérialisation
 
Programmes
Objets
Libs Utilitaires
Libs Internes
   
 
Editeur
Syntaxes
Windows
Versions
   

SCR/AL1 - TOME III. Les librairies utilitaires

5. Le groupe s_strs

5.14 SCR_vtom (file s_stvtom.c:99)

Syntax

unsigned char **SCR_vtom(str, sep)
unsigned char *str;
int sep;

Description

Vector to Matrix : crée un tableau de pointeurs à partir d'un string terminé par 0. Le séparateur de lignes est sep. La fonction alloue le tableau résultat ainsi que toutes les lignes à l'aide de SCR_malloc().

Le string input doit se terminer par un caractère nul. Le tableau résultat se termine par un pointeur nul.

La fonction inverse est SCR_mtov().

Valeur retournée

pointeur vers le tableau résultat alloué

Exemple

    PrintList(string)
unsigned char *string;
{
int i;
unsigned char **tbl;

tbl = SCR_vtom(string, ',');
for(i = 0 ; tbl[i] ; i++)
printf("\"%s\"\n", tbl[i]);
SCR_free_tbl(tbl);
}

PrintList("Jean,Marc,Pierre");

donne :

"Jean"
"Marc"
"Pierre"

Voir également

SCR_vtoms() SCR_mtov(), SCR_free_tbl();

5.14.1 File s_stvtom.c

unsigned char **SCR_vtom(str, sep)
unsigned char **SCR_vtoms(str, seps)
unsigned char **SCR_vtoms2(str, seps, supdbl)
unsigned char **SCR_vtoms3(str, seps, supdbl)

Copyright © 1998-2015 Jean-Marc Paul and Bernard PAUL - Envoyez vos remarques ou commentaires à bernard@xon.be