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

Subversion Repositories or1k

[/] [or1k/] [tags/] [stable/] [mp3/] [sw/] [utils/] [bin2hex.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 302 lampret
#include <stdio.h>
2
 
3
/* Number of bytes before line is broken
4
   For example if target flash is 8 bits wide,
5
   define BREAK as 1. If it is 16 bits wide,
6
   define it as 2 etc.
7
*/
8
#define BREAK 1
9
 
10
int main(int argc, char **argv)
11
{
12
 
13
        FILE  *fd;
14
        int c;
15
        int i = 0;
16
 
17
        if(argc < 2) {
18
                printf("no input file specified\n");
19
                exit(1);
20
        }
21
 
22
        fd = fopen( argv[1], "r" );
23
 
24
        while ((c = fgetc(fd)) != EOF) {
25
                printf("%.2lx", c);
26
                if (++i == BREAK) {
27
                        printf("\n");
28
                        i = 0;
29
                }
30
        }
31
        return 0;
32
}

powered by: WebSVN 2.1.0

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