5 /* Defino las extenciones que usan cada tipo de archivo */
6 #define EXT_TIPO3_ID ".id3"
7 #define EXT_TIPO3_DATA ".dat"
8 #define EXT_TIPO3_DISP ".fsc"
9 #define EXT_TIPO3_IDS ".idc"
11 char *str_dup(const char *s)
13 if (s == NULL) return NULL;
14 char *tmp = (char *)malloc(sizeof(char)*(strlen(s)+1));
20 EMUFS *emufs_crear(const char *filename, char tipo, unsigned int tam_bloque, unsigned int tam_reg)
24 EMUFS *tmp = (EMUFS *)malloc(sizeof(EMUFS));
33 tmp->tam_bloque = tam_bloque;
34 tmp->leer_bloque = leer_bloque;
35 tmp->leer_registro = leer_registro;
36 tmp->grabar_registro = grabar_registro;
37 tmp->borrar_registro = NULL;
38 tmp->nombre = str_dup(filename);
40 strcpy(name, filename);
41 strcat(name, EXT_TIPO3_DATA);
42 fp = fopen(name, "w");
49 /* Guardo el Header */
50 fwrite(&tipo, sizeof(char), 1, fp);
51 fwrite(&tam_bloque, sizeof(unsigned int), 1, fp);
52 fwrite(&tam_reg, sizeof(unsigned int), 1, fp);
55 strcpy(name, filename);
56 strcat(name, EXT_TIPO3_ID);
57 fp = fopen(name, "w");
60 strcpy(name, filename);
61 strcat(name, EXT_TIPO3_DISP);
62 fp = fopen(name, "w");
65 strcpy(name, filename);
66 strcat(name, EXT_TIPO3_IDS);
67 fp = fopen(name, "w");
79 int emufs_destruir(EMUFS *e)
81 if (e == NULL) return 1;