From 1251aa5beb1ae288e30468141c763d56e04a6bab Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Sun, 11 Apr 2004 08:29:39 +0000 Subject: [PATCH] =?utf8?q?=20*=20BUGFIX=20:=20error=20de=20typo=20=20*=20A?= =?utf8?q?hora=20la=20GUI=20puede=20abrir=20archivos=20existentes.=20Si=20?= =?utf8?q?gui=20se=20ejecuta=20sin=20=20par=C3=A1metros=20va=20a=20abrir?= =?utf8?q?=20el=20archivo=20existente.=20Si=20se=20ejecuta=20pasandole=20?= =?utf8?q?=20el=20parametro=20articulos.xml=20genera=20desde=200=20el=20ar?= =?utf8?q?chivo=20de=20articulos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- emufs/idx.c | 2 +- emufs/idx.h | 2 +- emufs_gui/articulos.c | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/emufs/idx.c b/emufs/idx.c index ae717e7..6db15a3 100644 --- a/emufs/idx.c +++ b/emufs/idx.c @@ -241,7 +241,7 @@ unsigned int emufs_idx_get_count(EMUFS *emu) 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]; diff --git a/emufs/idx.h b/emufs/idx.h index 616df90..fea4f3a 100644 --- a/emufs/idx.h +++ b/emufs/idx.h @@ -63,7 +63,7 @@ int emufs_idx_borrar(EMUFS*, EMUFS_REG_ID); 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*); diff --git a/emufs_gui/articulos.c b/emufs_gui/articulos.c index 78dc4f9..4899ab3 100644 --- a/emufs_gui/articulos.c +++ b/emufs_gui/articulos.c @@ -1,5 +1,6 @@ #include "articulos.h" +#include "idx.h" static t_LstArticulos *lst_articulos; @@ -12,7 +13,7 @@ t_LstArticulos *art_cargar(const char *filename) { xmlDocPtr document; xmlNode *node, *inicio; - int cant, size, error; + int cant, size, error, i, id; void *save; t_LstArticulos *tmp; lst_articulos = NULL; @@ -88,7 +89,20 @@ t_LstArticulos *art_cargar(const char *filename) 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; ifp, 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; -- 2.43.0