Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- typedef struct{
- char kod[20+1];
- float iznos;
- int dan;
- int mjesec;
- int godina;
- int sat;
- int minuta;
- int sekunda;
- }crypto;
- /*char* ucitajPoruku()
- {
- char* str = (char*) malloc(sizeof(char));
- *str = '\0';
- int n = 2;
- int key;
- char sup[2] = {'\0'};
- while((key = getc(stdin)) != '\n')
- {
- str = realloc(str, n * sizeof(char));
- sup[0] = (char) key;
- strcat(str, sup);
- n++;
- }
- return str;
- }*/
- int main()
- {
- char a[10][10];
- int n;
- int m = -1;
- int i = 0, j;
- int br = 0;
- crypto kripto[1000];
- FILE *fin = fopen("creepto.val", "rb+");
- FILE *fout = fopen("test.txt", "w");
- if(fin == NULL)
- exit(1);
- for(i = 0; i < 4; i++)
- {
- scanf("%c", a[i]);
- if(strcmp(a[i], "6") == 0)
- break;
- if(strcmp(a[i], "3") == 0)
- break;
- if(strcmp(a[i], "p") == 0)
- break;
- }
- //a = ucitajPoruku();
- while(fread(&kripto[i], sizeof(crypto), 1, fin) == 1)
- i++;
- br = i;
- fclose(fin);
- for(i = 0; i < br; i++)
- {
- char *pch = strstr(kripto[i].kod, a[0]);
- if(pch)
- {
- pch = NULL;
- pch = strstr(kripto[i].kod, a[1]);
- if(pch)
- {
- pch = NULL;
- pch = strstr(kripto[i].kod, a[2]);
- if(pch)
- {
- pch = NULL;
- pch = strstr(kripto[i].kod, a[3]);
- if(pch)
- {
- printf("asd");
- }
- }
- }
- }
- }
- /*if(br == strlen(a))
- {
- fprintf(fout,"%s@%.2d:%.2d:%.2d\n", kripto[i].kod, kripto[i].sat,
- kripto[i].minuta, kripto[i].sekunda);
- }*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement