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