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 int n1, n2, n3, n4, n5, n6, n7, n8;
55 printf("Modo de uso : %s tam_bloque\n", argv[0]);
59 if (atoi(argv[1]) < 104) {
60 printf("El tamaño de bloque debe ser mayor a 104\n");
64 strcpy(a, "1234567890");
65 strcpy(c, "REGISTRO NUMERO 2. ESTE REGISTRO ES MUCHO MAS LARGO QUE EL UNO");
66 strcpy(d, "ABCDEFGHIJKL");
67 strcpy(e, "HOLA soy un registro nuevo, me llamo E");
68 strcpy(f, "yo soy F");
69 strcpy(g, "me llamo G y quiero estar en el bloque 1");
70 strcpy(h, "un registro nuevo que se llama H, acompania a G en el bloque 1");
71 strcpy(i, "me argrego despues de borrar a un registro");
73 fp = emufs_crear("articulos", T3, atoi(argv[1]), 100);
75 n1 = fp->grabar_registro(fp, a, 100);
76 n2 = fp->grabar_registro(fp, c, 100);
77 /*n3 = fp->grabar_registro(fp, d, 100);
78 n4 = fp->grabar_registro(fp, e, 100);
79 n5 = fp->grabar_registro(fp, f, 100);
80 n6 = fp->grabar_registro(fp, g, 100);
81 n7 = fp->grabar_registro(fp, h, 100);
82 n8 = fp->grabar_registro(fp, i, 100);*/
83 printf("ID0 = %d\n", n1);
84 printf("ID1 = %d\n", n2);
85 printf("ID2 = %d\n", n3);
86 printf("ID3 = %d\n", n4);
87 printf("ID4 = %d\n", n5);
88 printf("ID5 = %d\n", n6);
89 printf("ID6 = %d\n", n7);
92 /*fp->borrar_registro(fp, n4, 100);
93 fp->borrar_registro(fp, n2, 100);
94 fp->borrar_registro(fp, n6, 100);*/
95 fp->borrar_registro(fp, n1, 100);
96 printf("borre el registro de id = %d\n",n1);
97 fp->leer_registro(fp, n2, b, 100);
99 printf("Recuperado : %s\n", b);