taskrambler  0.1.9
Web server and task management solution.
mmapfiletest2.c
Go to the documentation of this file.
1 // for random
2 #include <stdlib.h>
3 
4 // for puts
5 #include <stdio.h>
6 
7 // for time
8 #include <time.h>
9 
10 #include "class.h"
11 #include "commons.h"
12 #include "utils/memory.h"
13 
14 #include "asset.h"
15 
16 int
17 main(int argc, char * argv[])
18 {
19  size_t i;
20  size_t position;
21  char print_buf[101];
22 
23  Asset asset = new(Asset, CSTRA("./src/mmapfiletest.c"));
24 
25  print_buf[100] = '\0';
26 
27  srandom(time(NULL));
28  position = random() % (asset->size - 100);
29 
30  for (i=0; i<100; i+=10) {
31  print_buf[i+0] = asset->data[position+i+0];
32  print_buf[i+1] = asset->data[position+i+1];
33  print_buf[i+2] = asset->data[position+i+2];
34  print_buf[i+3] = asset->data[position+i+3];
35  print_buf[i+4] = asset->data[position+i+4];
36  print_buf[i+5] = asset->data[position+i+5];
37  print_buf[i+6] = asset->data[position+i+6];
38  print_buf[i+7] = asset->data[position+i+7];
39  print_buf[i+8] = asset->data[position+i+8];
40  print_buf[i+9] = asset->data[position+i+9];
41  }
42 
43  if (NULL != asset->mime_type) {
44  puts(asset->mime_type);
45  }
46  puts(print_buf);
47 
48  delete(asset);
49  memCleanup();
50 
51  return 0;
52 }
53 
54 // vim: set et ts=4 sw=4:
#define CSTRA(val)
Const STRing Argument.
Definition: memory.h:26
int main(int argc, char *argv[])
Definition: mmapfiletest2.c:17
void memCleanup()
Definition: memory.c:862