Sunteți pe pagina 1din 34

METODO INDEXADO

CURSO PROFESOR ALUMNOS

: : :

Organizacin de Archivos GORGE GUTIERREZ Frank Castro Reyna Keven Saldaa Altamirano Raul Sarachaga Diaz

CICLO

IV

TRUJILLO 2011

PER

INTRODUCCION

El presente trabajo realizado por los alumnos de la escuela de Ing. Informatica , pretende hacer de conocimiento lo visto en las clases de el curso de organizacin de archivos dictado por el Ing. Gorge Gutierrez tratando el tema de metodo indexado , y aportar asi nuestro conociminto plasmado en este informe. De antemano gracias al lector(s).

FUNCIONAMIENTO DEL METODO INDEXADO


Indexado -> ordenado

1) Buscar el indice el el archivo de indices (busqueda binaria).

Ptr <- busqueda binaria (indice) 2) Aplicar acceso directo al archivo de datos y reportar los datos adjuntos.

*indice: - El dominio del indice debe ser un conjunto disjunto, es decir valores unicos(indice primario). - Indice secundario, presenta valores no necesariamente unicos. Ejemplo: Indice primario Indice secundario codigo de alumno sanchez (apellido)

- Los indices en otras literaturas se denominan tambien : * claves * key * llave - Se puede concatenar campos (datos del usuario) para formar indices primarios .

Ejemplo: Ind 1 <- ap. Paterno + ap. Materno Ind 2 <- nombre + ap. Paterno Ind 3 <- cepunt + mod + puesto + ao Ejemplo:

MANTENIMIENTO DEL METODO INDEXADO

a) Consultar , no implica ninguna molestia.

b) Agregar , es complicado.

*M no puede , inseratrse dentro del archivo porque tarda mucho tiempo.

c)eliminar:

Algoritmo de busqueda binaria () { band d=F; M=(i + f)/2 While ( f > i) { { } If (band==F) cout<<no existe; } if (dx > m) { i<-m ; continue; } if (dx < m) { f<-m ; continue; }

band= v ; break;

Cmo funciona el metodo indexado? 1. Se crean 2 archivos.

2. Se crea un buffer de memoria y se copia todo el buffer (guarda los indices)

i.ind

al

3. Mantenimiento del metodo indexado ( consultar , agregar , eliminar)

4. Al cerrar los archivos copiar el buffer al indice .

Durante el mantenimiento:

REINDEXAR 1. Copia las dx a Ram 2. Ordenar Ram 3. Escribir en archivo*.IND Generar a partir del *.txt el archivo *.ind METODO INDEXADO

*Ram puede ser un vector de instrucciones o una L.E.

ALGORITMO: Busqueda (reportar un telefono dado el nombre) Reindexar (generar el archivo *.ind a partir del archivo *.txt ) Mantenimiento (agregar , eliminar,crear)

Struct buffer { int NR; char clave[15]; int PR ; } ram;

// algoritmo de busqueda Busqueda (char * nom) { // 1.abrir archivo if( ( fd=open(i.txt , 0 _TEXT ) ) < 0) { } Read(fd,&le1,le1); If(e.band==F) {reindexar();}

If((fdi=open( i.ind,0_TEXT ) )<0 ) {} // 2. Copiar indice al buffer Copiar_a_buffer();

//3. Busqueda binaria Cout<<nombre;gets(nom); nr <- binario (nom); if(nr==-1) { return ; } //4.acceso directo en *.txt P=(nr-1)*ld + le1; lseek(fd,p,0); read(fd,&d,ld); cout<<telf:<<d.tlf; close all(); }

//binario Int binario(char*n) { int ini=0,band=F; Fin<-e 2.nrs; While( fin>ini) { med = int ( ( ini + fin )/2 ); If ( stremp(n.ram[med].nom)>0 ) { ini<-med; continue;}

If ( strcmp( n,ram[med].nom)<0 ) { fin <-med; continue;} Band=v Return ram [med].ptr; } If (band==F) { cout<<no existe ; } return -1; } } //copiar a buffer Void copiar_a_buffer(int nrs) { Int i=0; Ram =new struct buffer[nrs]; While(i<nrs) { read (fdi,&ram[i++],li); } }

//reindexar

Void reindexar() { System(DEL F :\\i.ind); //eliminado archivo indice If(( Fd2 =creat(i.ind,S_IWRITE/S_IREAD))<0) { } X<- e1.PR; While(x!=-1 ) { p=(x-1)*ld+le1;

Lseek (fld,p,0); Read(fld;fd,ld); i=.NRS++; strcmp(d.nom,i.clave); i.PTR<-d.NR; while(fdi,&i,li); x<-d.SR; } lseek(fdi,0,0); } Para el matenimiento del metodo indexado: 1) Agregar : (inserta nuevos registros) 2) Modificar: dx(dato)que no es clave ,actualizacion del *.txt dx que es una clave , actualizacion del buffer

3) Eliminar : actualizar le L.E. del archivo de datos.

INFORMACION ADICIONAL : INDEXADO

Archivos Indexados Es la aplicacin de incluir ndices en el almacenamiento de los archivos; de esta forma nos ser ms fcil buscar algn registro sin necesidad de ver todo el archivo. Un ndice en un archivo consiste en un listado de los valores del campo clave que ocurren en el archivo, junto con la posicin de registro correspondiente en el almacenamiento masivo. Los ndices apoyan las aplicaciones que accesan selectivamente

registros individuales, en lugar de buscar a travs de toda la coleccin de registros en secuencia. Un campo ( o un grupo de campos) es utilizado como campo de ndice. Por ejemplo, en una aplicacin bancaria, podra existir un archivo de registros que describiesen a las sucursales. Por lo que sera adecuado indexar el archivo en base al nombre de la sucursal, para proporcionar informacin de una sucursal en particular a travs de consulta interactiva.

Fundamento de los ndices 1. La colocacin de un listado al inicio del archivo: para la identificacin del contenido.

2. La presentacin de un segundo ndice: para reflejar la informacin de cada punto principal del ndice anterior.

3. La actualizacin de los ndices: Cuando se insertan y eliminan archivos, es preciso actualizar los ndices para evitar contratiempos actualizando un archivo.

4. La organizacin de un ndice: Nos evita examinar archivo por archivo para recuperar algn registro buscado; por lo tanto ahorraramos tiempo si tenemos una adecuado organizacin de los ndices.

El siguiente es un proyecto realizado en la clase de ORGANIZACIN DE ARCHIVOS por el profesor Gorge Gutierrez.

ANEXO: codigo del programa MENU PRINCIPAL: #include <cstdlib> #include <iostream> #include "interfaz.h" using namespace std; int main(int argc, char *argv[]) { Inicia_Seccion(); system("cls"); int op=0; system("cls"); do { op=Menu(); switch(op) { case 1: {Escribir(); break;} case 2: {Leer(); break;} case 3: {Agregar();break;} case 4: {Actualizar();break;} case 5: {Eliminar();break;} case 6: {Deseliminar();break;} case 7: {Mostrar_Dx(); break;} case 8: {cargando(1);break;} default:{};break; } } while (op!=8); cout<<"\t\t\t\t\t "; return EXIT_SUCCESS;

Estructura del registro de datos: struct Reg_Dx { int NR; char Nombre[15]; char Apellido[15]; int ARE; } rd,ad; int lrd=sizeof(struct Reg_Dx); /* Encabezado del registro de datos*/ struct Encabezado_Dx { int NRS; int BAND; int URE; } ed; int led=sizeof(struct Encabezado_Dx); /* Estructura del registro indice */ struct Reg_Ind { int NR; char Clave_N[15]; int PTR_Nom; char Clave_A[15]; int PTR_Ape; } ri; int lri=sizeof(struct Reg_Ind);

/* Encabezado del registro indice */ struct Encabezado_Ind { int NRS; } ei; int lei=sizeof(struct Encabezado_Ind); int fdd; /*fichero de datos*/ int fdi; /*fichero de indices*/

void Reindexar() { if((fdd=open("Archivo.txt", O_RDWR))<0) { cout<<"\n\n\t\t\t\t\t\tNo existe ningun archivo "<<endl; cout<<"\t\t\t\t\t "; system("PAUSE"); return; } read(fdd,&ed,led); if(ed.BAND==1) { lseek(fdd,0,0); read(fdd,&ed,led); ed.BAND=0; lseek(fdd,0,0); write(fdd,&ed,led); Actualizar_Ind(); close(fdd); close(fdi); } } void Datos(int cont) { fflush(stdin); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<" * Nombre : "; gets(rd.Nombre); cout<<"\n\n\t\t\t\t\t"; cout<<" * Apellido : "; gets(rd.Apellido); cout<<"\n\n\t\t\t\t";

rd.ARE=0; Alm_Dx_BF(rd.Nombre, rd.NR , rd.Apellido, cont); } struct Buffer // si hay 2 buffer es porque hay 2 punteros { char Clave[15]; int PTR; } BN[100], BA[100], AUX[100],aux2,s;

/* Se almacenan los datos ingresados en un vector de estructuras el cual se usara como buffer */ void Alm_Dx_BF(char N[15], int nr , char A[15] , int i) { strcpy(BN[i].Clave,N); BN[i].PTR=nr; strcpy(BA[i].Clave,A); BA[i].PTR=nr; } void reconstruirheap( struct Buffer, int n , int i) { int hijoizq; int hijoder; int j=0; // char aux[100]; if(i<(n/2)) { hijoizq = 2*i+1; hijoder = 2*i+2; j=hijoizq; if((hijoder<n) && (strcmp(AUX[hijoder].Clave,AUX[j].Clave)>0) ) /*cambiar signo en segundo parentesis ! para ke el se arregle descendentement =D! */ { j=hijoder; } if((strcmp(AUX[j].Clave,AUX[i].Clave)>0)) /* cambiar signo! */ {

aux2=AUX[j]; AUX[j]=AUX[i]; AUX[i]=aux2; reconstruirheap(*AUX,n,j); } } } void construirheap( struct Buffer , int n ) { for( int i=(n/2)-1;i>=0;i--) {reconstruirheap(*AUX,n,i); } }

void heapsort (struct Buffer, int n) { int m; // char aux[100]; construirheap(*BN,n); m=n; while ( m > 1 ) { aux2=AUX[0]; AUX[0]=AUX[m-1]; AUX[m-1]=aux2; reconstruirheap(*AUX,m-1,0); m=m-1; } } void Copiar(struct Buffer, struct Buffer,int iden) { if(iden==1) { for(int i=1;i<=rd.NR;i++){ AUX[i]=BN[i]; } } if(iden==2) { for(int i=1;i<=rd.NR;i++){ BN[i]=AUX[i]; } } if(iden==3) { for(int i=1;i<=rd.NR;i++){ AUX[i]=BA[i]; } } if(iden==4) { for(int i=1;i<=rd.NR;i++){ BA[i]=AUX[i]; } } } void ActualizarLista(int nr) { Copiar(*BN, *AUX,1); heapsort(*AUX,nr); Copiar(*AUX, *BN,2); Copiar(*BA, *AUX,3); heapsort(*AUX,nr); Copiar(*AUX, *BA,4);

} void Escribir_Ind(struct Buffer, struct Buffer, int n) { for(int i=1;i<n;i++) { // se esta cargando los 4 campos del ri para k todos los datos dse queden permanentemente en el ind fflush(stdin); ri.NR=++ei.NRS; strcpy(ri.Clave_N,BN[i].Clave); ri.PTR_Nom=BN[i].PTR; strcpy(ri.Clave_A,BA[i].Clave); ri.PTR_Ape=BA[i].PTR; write(fdi,&ri,lri); } lseek(fdi,0,0); write(fdi,&ei,lei); system("PAUSE"); } void Escribir() { char rpta = 's'; if((fdd=creat("Archivo.txt",S_IWRITE | S_IREAD))<0) {return;} if((fdi=creat("Archivo.ind",S_IWRITE | S_IREAD))<0) {return;} lseek(fdd,led,0); lseek(fdi,lei,0); rd.NR=0; ed.NRS=0; ed.BAND=0; /*si la bandera esta en cero significa archivo indice actualizado*/ ed.URE=-1; int cont=0; while(rpta == 's') { system("cls"); rd.NR=++ed.NRS; cont++; Datos(cont); write(fdd,&rd,lrd); cout<<" * Seguir Registrando : "; cin>>rpta; } ActualizarLista(rd.NR+1); lseek(fdd, 0 , 0);

write(fdd, &ed, led); Escribir_Ind(*BN, *BA, rd.NR+1); close(fdd); close(fdi); } int Buscar(char Busca[], int iden) { int inicio; int final; int medio; int band; int pos;

if((fdi=open("Archivo.ind",O_TEXT))<0) { cout<<"No se pudo abrir el fichero \n\n"; return -1; } read(fdi,&ei,lei); inicio=1; final=ei.NRS+1; band=0; while(final > inicio) { medio= int((inicio+final)/2); pos=(medio-1)*lri+lei; lseek(fdi,pos,0); read(fdi,&ri,lri); if(iden == 0) /* 0 busca nombres */ { if((strcmp(Busca,ri.Clave_N))>0) { inicio=medio; continue; } if((strcmp(Busca,ri.Clave_N))<0) { final=medio; continue; } band=1;

return ri.PTR_Nom; } if(iden == 1 ) /* 1 busca apellido*/ { if((strcmp(Busca,ri.Clave_A))>0) { inicio=medio; continue; } if((strcmp(Busca,ri.Clave_A))<0) { final=medio; continue; } band=1; return ri.PTR_Ape; } } if(band==0) { return 0; } } void Leer() { char Nombre[15]; char Apellido[15]; int nr; int pos; int op=0; if((fdd=open("Archivo.txt", O_TEXT))<0) { cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE"); return; } read(fdd,&ed,led); fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"Busqueda por : \n\n\n"; cout<<"\t\t\t\t [1] Nombre \n\n\n"; cout<<"\t\t\t\t [2] Apellido \n\n\n"; cout<<"\t\t\t * Opcion : "; cin>>op;

if(op==1) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nombre :" ; gets(Nombre); nr=Buscar(Nombre,0); } if(op==2) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Apellido :" ; gets(Apellido); nr=Buscar(Apellido,1); } if( nr == -1) { cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE");return;} if( nr == 0 ) { cout<<"Registro no existe \n\n";system("PAUSE");} else { pos=(nr-1)*lrd+led; lseek(fdd,pos,0); read(fdd,&rd,lrd); cout<<"\n\n\n\n\n\n"; cout<<"\t\t\t\t\t\t * Nombre : "<<rd.Nombre<<endl; cout<<"\t\t\t\t\t\t * Apellido : "<<rd.Apellido<<endl; cout<<"\n\n\n\n\n\n"; cout<<"\t\t\t\t\t "; system("PAUSE"); } close(fdd); close(fdi); } void Mostrar_Dx() { system("cls"); if((fdd=open("Archivo.txt", O_TEXT))<0){return ;} if((fdi=open("Archivo.ind", O_TEXT))<0){return ;} cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl; read(fdd, &ed, led);

cout<<"\n\t\t***********************Archivo.txt******* **************** "; cout<<"\n\n\t\tURE: "<<ed.URE<<"\tNRS: "<<ed.NRS<<"\tBAND: "<<ed.BAND<<endl; cout<<"\t\tNR\tNombre\tApellido\tAre\n"; cout<<"\t\t----------------------------------------\n"; while( (read(fdd, &rd, lrd))>0) { cout<<"\t\t"<<rd.NR<<"\t"<<rd.Nombre<<"\t"<<rd.Apel lido<<"\t"<<rd.ARE<<endl; } cout<<"\n\t\t*************************************** ******************\n\n"; read(fdi, &ei, lei); cout<<"\n\t\t***********************Archivo.ind******* **************** "; cout<<"\n\n\t\tNRS: "<<ei.NRS<<endl; cout<<"\t\tNR\tClave_N\tPtr_N\tClave_A\tPtr_A\n"; cout<<"\t\t--------------------------------------\n"; while( (read(fdi, &ri, lri))>0) { cout<<"\t\t"<<ri.NR<<"\t"<<ri.Clave_N<<"\t"<<ri.PTR_ Nom<<"\t"<<ri.Clave_A<<"\t"<<ri.PTR_Ape<<endl; } cout<<"\n\t\t*************************************** ******************\n\n"; close(fdd); close(fdi); cout<<"\t\t\t\t\t "; system("PAUSE"); } void Actualizar_Ind() /* a copiar todos los que no estan eliminados al buffer y luego*/ { /* crea el nuevo archivo indice :D */ int cont=0; lseek(fdd,0,0); lseek(fdd,led,0); while(read(fdd,&rd,lrd)>0) { if(rd.ARE==0) { cont++; Alm_Dx_BF(rd.Nombre,rd.NR,rd.Apellido,cont);

} } ActualizarLista(cont+1); /*ordenamos el buffer*/ system("del Archivo.ind"); if(( fdi = creat("Archivo.ind",S_IWRITE | S_IREAD))<0) {return;} ei.NRS=0; ri.NR=0; lseek(fdi,lei,0); Escribir_Ind(*BN, *BA, cont+1); }

void Eliminar() { char Nombre[15]; char Apellido[15]; int nr; int pos; int op=0; char rpta='s'; if((fdd=open("Archivo.txt", O_RDWR))<0) { cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE"); return; } read(fdd,&ed,led); ed.BAND=1; lseek(fdd,0,0); write(fdd,&ed, led); lseek(fdd,0,0); read(fdd,&ed,led); while(rpta == 's') { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"Eliminar por : \n\n\n"; cout<<"\t\t\t\t [1] Nombre \n\n\n"; cout<<"\t\t\t\t [2] Apellido \n\n\n"; cout<<"\t\t\t * Opcion : "; cin>>op;

if(op==1) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nombre :" ; gets(Nombre); nr=Buscar(Nombre,0); } if(op==2) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Apellido :" ; gets(Apellido); nr=Buscar(Apellido,1); } pos=(nr-1)*lrd+led; lseek(fdd, pos, 0); read(fdd, &rd, lrd); rd.ARE=ed.URE; ed.URE=rd.NR; lseek(fdd,pos,0); write(fdd,&rd,lrd); cout<<"\n\n\t\t\t\t * Seguir Eliminando (s/n) : "; cin>>rpta; close(fdi); } Actualizar_Ind(); ed.BAND=0; lseek(fdd,0,0); write(fdd,&ed,led); close(fdd); close(fdi); } void Agregar() { system("cls"); int nr; int pos; int op=0; char rpta='s'; if((fdd=open("Archivo.txt", O_RDWR))<0)

{ cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE"); return; } read(fdd,&ed,led); ed.BAND=1; lseek(fdd,0,0); write(fdd,&ed, led); lseek(fdd,0,0); read(fdd,&ed,led); while(rpta=='s') { if(ed.URE==-1) { rd.NR=++ed.NRS; lseek(fdd,0,2); } else { pos=(ed.URE-1)*lrd+led; lseek(fdd,pos,0); read(fdd,&rd,lrd); ed.URE=rd.ARE; lseek(fdd,pos,0); } fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<" * Nombre : "; gets(rd.Nombre); cout<<"\n\n\t\t\t\t\t"; cout<<" * Apellido : "; gets(rd.Apellido); cout<<"\n\n\t\t\t\t"; rd.ARE=0; write(fdd,&rd,lrd); cout<<"\n\n\t\t\t\t * Seguir Agregando (s/n) : "; cin>>rpta; } Actualizar_Ind(); ed.BAND=0; lseek(fdd,0,0); write(fdd,&ed,led); close(fdd); close(fdi); }

void Deseliminar() { system("cls"); int nr; int pos; int op=0; char rpta='s'; char Nombre[15]; char Apellido[15]; int temp; if((fdd=open("Archivo.txt", O_RDWR))<0) { cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE"); return; } read(fdd,&ed,led); ed.BAND=1; lseek(fdd,0,0); write(fdd,&ed, led); lseek(fdd,0,0); read(fdd,&ed,led); temp=ed.URE; while(rpta == 's') { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"Recuperar Datos por : \n\n\n"; cout<<"\t\t\t\t [1] Nombre \n\n\n"; cout<<"\t\t\t\t [2] Apellido \n\n\n"; cout<<"\t\t\t * Opcion : "; cin>>op; if(op==1) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nombre :" ; gets(Nombre); while(temp!=-1)

{ pos=(temp-1)*lrd+led; lseek(fdd,pos,0); read(fdd, &rd, lrd); if(strcmp(rd.Nombre,Nombre)==0) { if(rd.NR==ed.URE) { ed.URE=rd.ARE; rd.ARE=0; lseek(fdd,pos,0); write(fdd,&rd,lrd); break; } else { ad.ARE=rd.ARE; rd.ARE=0; lseek(fdd,pos,0); write(fdd,&rd,lrd); pos=(ad.NR-1)*lrd+led; lseek(fdd,pos,0); write(fdd,&ad,lrd); break; } } ad=rd; temp=rd.ARE; } } if(op==2) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Apellido :" ; gets(Apellido); while(temp!=-1) { pos=(temp-1)*lrd+led; lseek(fdd,pos,0); read(fdd, &rd, lrd); if(strcmp(rd.Apellido,Apellido)==0) { if(rd.NR==ed.URE) {

ed.URE=rd.ARE; rd.ARE=0; lseek(fdd,pos,0); write(fdd,&rd,lrd); break; } else { ad.ARE=rd.ARE; rd.ARE=0; lseek(fdd,pos,0); write(fdd,&rd,lrd); pos=(ad.NR-1)*lrd+led; lseek(fdd,pos,0); write(fdd,&ad,lrd); break; } } ad=rd; temp=rd.ARE; } } cout<<"\n\n\t\t\t\t * Seguir Recuperando Datos (s/n) : "; cin>>rpta; } Actualizar_Ind(); ed.BAND=0; lseek(fdd,0,0); write(fdd,&ed,led); close(fdd); close(fdi); } void Actualizar() { char Nombre[15]; char Apellido[15]; int nr; int pos; int op=0; char rpta='s'; if((fdd=open("Archivo.txt", O_RDWR))<0) { cout<<"Archivo no se puede Abrir"<<endl; system("PAUSE"); return; }

read(fdd,&ed,led); ed.BAND=1; lseek(fdd,0,0); write(fdd,&ed, led); lseek(fdd,0,0); read(fdd,&ed,led); while(rpta == 's') { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"Actualizar: \n\n\n"; cout<<"\t\t\t\t [1] Nombre \n\n\n"; cout<<"\t\t\t\t [2] Apellido \n\n\n"; cout<<"\t\t\t * Opcion : "; cin>>op; if(op==1) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nombre :" ; gets(Nombre); nr=Buscar(Nombre,0); pos=(nr-1)*lrd+led; lseek(fdd, pos, 0); read(fdd, &rd, lrd); fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nuevo Nombre :" ; gets(rd.Nombre); lseek(fdd, pos, 0); write(fdd, &rd, lrd); } if(op==2) { fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Apellido :" ; gets(Apellido); nr=Buscar(Apellido,1); pos=(nr-1)*lrd+led;

lseek(fdd, pos, 0); read(fdd, &rd, lrd); fflush(stdin); system("cls"); cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t"; cout<<"[*] Ingrese Nuevo Apellido :" ; gets(rd.Apellido); lseek(fdd, pos, 0); write(fdd, &rd, lrd); } cout<<"\n\n\t\t * Seguir Actualizando (s/n) : "; cin>>rpta; close(fdi); } Actualizar_Ind(); ed.BAND=0; lseek(fdd,0,0); write(fdd,&ed,led); close(fdd); close(fdi); } GRACIAS POR LEER NUESTRO HUMILDE APORTE AL CONOCIMIENTO

FACULTAD DE CIENCIAS FISICAS Y MATEMATICAS ESCUELA ACADEMICO PROFESIONAL DE INGENIERIA INFORMATICA

S-ar putea să vă placă și