return tam/sizeof(EMUFS_IDX);
}
-unsigned long emufs_idx_get_id_att(EMUFS *emu, unsigned int pos)
+unsigned long emufs_idx_get_id_at(EMUFS *emu, unsigned int pos)
{
FILE *fp;
char name_f_idx[255];
unsigned int emufs_idx_get_count(EMUFS *);
-unsigned long emufs_idx_get_id_att(EMUFS *, unsigned int pos);
+unsigned long emufs_idx_get_id_at(EMUFS *, unsigned int pos);
EMUFS_REG_ID emufs_idx_get_new_id(EMUFS*, int*);
#include "articulos.h"
+#include "idx.h"
static t_LstArticulos *lst_articulos;
{
xmlDocPtr document;
xmlNode *node, *inicio;
- int cant, size, error;
+ int cant, size, error, i, id;
void *save;
t_LstArticulos *tmp;
lst_articulos = NULL;
xmlCleanupParser();
} else {
tmp->fp = emufs_abrir("articulos");
- /* TODO Cargar registros desde el archivo */
+ /* Ahora trato de recuperar la info */
+ cant = emufs_idx_get_count(tmp->fp);
+ for(i=0; i<cant; i++) {
+ t_Articulo art;
+ id = emufs_idx_get_id_at(tmp->fp, i);
+ /* Leo el registro */
+ save = tmp->fp->leer_registro(tmp->fp, id, &size, &error);
+ if (procesar_leer_articulo(&art, save, size, tmp) == 1) {
+ tmp->array[i].num_reg = i;
+ tmp->array[i].numero = art.numero;
+ free(save);
+ }
+ }
+ tmp->cant = cant;
}
return tmp;