OpenCores
URL https://opencores.org/ocsvn/c16/c16/trunk

Subversion Repositories c16

[/] [c16/] [trunk/] [bin2array.cc] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 jsauermann
#include <stdio.h>
2
#include <assert.h>
3
 
4
int main(int argc, char * argv[])
5
{
6
   assert(argc == 2);
7
 
8
FILE * in = fopen(argv[1], "rb");
9
   assert(in);
10
 
11
unsigned char buffer[8];
12
 
13
   for (;;)
14
      {
15
        int len = fread(buffer, 1, 8, in);
16
        if (len <= 0)   break;
17
        printf("    ");
18
        for (int i = 0; i < len; i++)   printf("0x%2.2X, ", buffer[i]);
19
        printf("\n");
20
      }
21
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.