taskrambler  0.1.9
Web server and task management solution.
mmapfiletest2.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "class.h"
#include "commons.h"
#include "utils/memory.h"
#include "asset.h"
+ Include dependency graph for mmapfiletest2.c:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 17 of file mmapfiletest2.c.

References CSTRA, and memCleanup().

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 }
#define CSTRA(val)
Const STRing Argument.
Definition: memory.h:26
void memCleanup()
Definition: memory.c:862

+ Here is the call graph for this function: