1 /* vim: set noexpandtab tabstop=4 shiftwidth=4:
2 *----------------------------------------------------------------------------
4 *----------------------------------------------------------------------------
5 * This file is part of emufs.
7 * emufs is free software; you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option) any later
12 * emufs is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along
18 * with emufs; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
20 *----------------------------------------------------------------------------
21 * Creado: mié mar 31 17:26:46 ART 2004
22 * Autores: Nicolás Dimov <sagardua@uolsinectis.com.ar>
23 *----------------------------------------------------------------------------
31 * Prueba de archivo \ref tipo3.h "tipo3".
40 int main(int argc, char *argv[])
43 EMUFS_REG_ID n1, n2, n3, n4, n5, n6, n7, n8;
44 EMUFS_REG_SIZE reg_size;
58 printf("Modo de uso : %s tam_bloque\n", argv[0]);
62 if (atoi(argv[1]) < 104) {
63 printf("El tamaño de bloque debe ser mayor a 104\n");
67 strcpy(a, "1234567890");
68 strcpy(c, "REGISTRO NUMERO 2. ESTE REGISTRO ES MUCHO MAS LARGO QUE EL UNO");
69 strcpy(d, "ABCDEFGHIJKL");
70 strcpy(e, "HOLA soy un registro nuevo, me llamo E");
71 strcpy(f, "yo soy F");
72 strcpy(g, "me llamo G y quiero estar en el bloque 1");
73 strcpy(h, "un registro nuevo que se llama H, acompania a G en el bloque 1");
74 strcpy(i, "me argrego despues de borrar a un registro");
76 fp = emufs_crear("articulos", T3, atoi(argv[1]), 100);
78 n1 = fp->grabar_registro(fp, a, 100, &err);
79 n2 = fp->grabar_registro(fp, c, 100, &err);
80 n3 = fp->grabar_registro(fp, d, 100, &err);
81 n4 = fp->grabar_registro(fp, e, 100, &err);
82 n5 = fp->grabar_registro(fp, f, 100, &err);
83 n6 = fp->grabar_registro(fp, g, 100, &err);
84 n7 = fp->grabar_registro(fp, h, 100, &err);
85 n8 = fp->grabar_registro(fp, i, 100, &err);
89 if ( fp->borrar_registro(fp, n3) == -1) printf("la cague %d\n",n3);
90 if ( fp->borrar_registro(fp, n5) == -1) printf("la cague %d\n",n5);
91 if ( fp->borrar_registro(fp, n7) == -1) printf("la cague %d\n",n7);
93 b_ptr = fp->leer_registro(fp, n4, ®_size, &err);
95 printf("Recuperado : %s\n", b_ptr);