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;
57 printf("Modo de uso : %s tam_bloque\n", argv[0]);
61 if (atoi(argv[1]) < 104) {
62 printf("El tamaño de bloque debe ser mayor a 104\n");
66 strcpy(a, "1234567890");
67 strcpy(c, "REGISTRO NUMERO 2. ESTE REGISTRO ES MUCHO MAS LARGO QUE EL UNO");
68 strcpy(d, "ABCDEFGHIJKL");
69 strcpy(e, "HOLA soy un registro nuevo, me llamo E");
70 strcpy(f, "yo soy F");
71 strcpy(g, "me llamo G y quiero estar en el bloque 1");
72 strcpy(h, "un registro nuevo que se llama H, acompania a G en el bloque 1");
73 strcpy(i, "me argrego despues de borrar a un registro");
75 fp = emufs_crear("articulos", T3, atoi(argv[1]), 100);
77 n1 = fp->grabar_registro(fp, a, 100);
79 n2 = fp->grabar_registro(fp, c, 100);
81 n3 = fp->grabar_registro(fp, d, 100);
82 n4 = fp->grabar_registro(fp, e, 100);
83 n5 = fp->grabar_registro(fp, f, 100);
84 n6 = fp->grabar_registro(fp, g, 100);
85 n7 = fp->grabar_registro(fp, h, 100);
86 n8 = fp->grabar_registro(fp, i, 100);
90 fp->borrar_registro(fp, n5);
91 printf("borre el registro de id = %lu\n",n5);
92 b_ptr = fp->leer_registro(fp, n2, &err);
94 printf("Recuperado : %s\n", b_ptr);