define(`TITLE', `Has this large file something else than zeros?')
define(`DATE', `2013-11-08')
define(`CONTENT', `
This small piece of code was used during the analysis of an 800GB VMWare image after a server crash.

notnull.c:
<pre>
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

int main(int argc, const char* argv[]) {
  if (argc != 2) {
    printf(&quot;give filenamen&quot;);
    exit(1);
  }


  FILE *f = fopen(argv[1], &quot;r&quot;);

  const unsigned int BUFSIZE = 4096;
  unsigned char buffer[BUFSIZE];

  unsigned long cnt = 0;
  unsigned long found = 0;
  size_t r;

  while (0 != (r = fread(&amp;buffer, 1, BUFSIZE, f))) {
    cnt += r;
    for (int i = 0; i &lt; r; i++) {
      if (0 != *(buffer + i)) {
        found++;
      }
    }
    if (0 == (cnt % 1000000)) {
      printf(&quot;cnt: %ld, found: %ldn&quot;, cnt, found);
    }
  }

  printf(&quot;finally: cnt: %ld, found: %ldn&quot;, cnt, found);
}
</pre>

Compile it using:
<pre>
gcc -std=c99 -o notnull notnull.c
</pre>
')