Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 28th, 2012  |  syntax: C  |  size: 2.14 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2. pev - the PE file analyzer toolkit
  3. output.c - functions to output results in different formats
  4.  
  5. Copyright (C) 2012 Fernando Mercês
  6. Copyright (C) 2012 Gabriel Duarte
  7. Copyright (C) 2012 Jan Seidl
  8.  
  9. This program is free software: you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation, either version 3 of the License, or
  12. (at your option) any later version.
  13.  
  14. This program is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22.  
  23. #include <string.h>
  24. #include <stdlib.h>
  25. #include <ctype.h>
  26. #include <stdio.h>
  27.  
  28. // Da structs
  29.  
  30. struct Sector
  31. {
  32.  
  33.     char title[255];
  34.  
  35.     struct Line *firstline;
  36.  
  37.     struct Sector *parent;
  38.     struct Sector *child;
  39.  
  40.     struct Sector *next;
  41.     struct Sector *prev;
  42.  
  43. }
  44.  
  45. struct Line
  46. {
  47.     char key[255];
  48.     char value[255];
  49.  
  50.     struct Line *next;
  51.     struct Line *prev;
  52. }
  53.  
  54. int main(int argc, char* argv[])
  55. {
  56.  
  57.  
  58.     // Cria sector 1 e subsector 1.1
  59.     struct Sector sector1;
  60.     struct Sector sector1_1;
  61.  
  62.     // Cria sector 2
  63.     struct Sector sector2;
  64.  
  65.     // Cria as lines
  66.     struct Line line1_a;// sect 1
  67.     struct Line line1_b;// sect 1
  68.     struct Line line1_1_a; // sect 1.1
  69.     struct Line line1_1_b; // sect 1.1
  70.     struct Line line2; // sect 2
  71.  
  72.     // Attach all sector relationships
  73.     sector1->child = &sector1_1;
  74.     sector1->next = &sector2;
  75.     sector1->firstline = &line1_a;
  76.     sector2->prev = &sector1;
  77.  
  78.     // sector 1
  79.     line1_a->key "Line 1a key";
  80.     line1_a->value "Line 1a value";
  81.  
  82.     line1_a->next = &line1_b;
  83.  
  84.     line1_b->key = "Line 1b key";
  85.     line1_b->value = "Line 1b value";
  86.     line1_b->prev = &line1_a;
  87.  
  88.     // sector 2
  89.  
  90.     line2->key = "Linha 1 da sect 2";
  91.     line2->value = "Valor da linha 1 da sect 2";
  92.  
  93.     sector2->firstline = &line2;
  94.  
  95.  
  96. }