Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #define maxMmap 4096
- typedef struct{
- int *dir;
- int Bytes;
- int month;
- int dia;
- int hora;
- int min;
- char nombre[20];
- int filedescriptor;
- }mmapTipo;
- mmapTipo *HistMmap[maxMmap];
- int nmmap = 0; //Numero de elementos en el array
- void histMmapInsert(int *dir, int Bytes, int month, int dia, int hora, int min, char *nombre, int filedescriptor){
- if(nmmap == maxMmap){
- printf("Espacio del historial agotado");
- return;
- }
- else{
- nmmap++;
- HistMmap[nmmap-1]=malloc(sizeof(mmapTipo));
- HistMmap[nmmap-1]->dir=dir;
- HistMmap[nmmap-1]->Bytes=Bytes;
- HistMmap[nmmap-1]->month=month;
- HistMmap[nmmap-1]->dia=dia;
- HistMmap[nmmap-1]->hora=hora;
- HistMmap[nmmap-1]->min=min;
- strcpy(HistMmap[nmmap-1]->nombre,nombre);
- HistMmap[nmmap-1]->filedescriptor=filedescriptor;
- }
- }
- mmapTipo *histMmapElemento(int n){
- return HistMmap[n];
- }
- int histMmapNumElementos(){
- return nmmap;
- }
- void histMmapBorrar(){
- int i;
- for(i=0; i <= nmmap; i++){
- free(HistMmap[i]);
- }
- nmmap = 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement