URL
https://opencores.org/ocsvn/or1k/or1k/trunk
[/] [or1k/] [tags/] [stable/] [mp3/] [sw/] [utils/] [bin2hex.c] - Diff between revs 392 and 1765
Only display areas with differences |
Details |
Blame |
View Log
Rev 392 |
Rev 1765 |
#include <stdio.h>
|
#include <stdio.h>
|
|
|
/* Number of bytes before line is broken
|
/* Number of bytes before line is broken
|
For example if target flash is 8 bits wide,
|
For example if target flash is 8 bits wide,
|
define BREAK as 1. If it is 16 bits wide,
|
define BREAK as 1. If it is 16 bits wide,
|
define it as 2 etc.
|
define it as 2 etc.
|
*/
|
*/
|
#define BREAK 1
|
#define BREAK 1
|
|
|
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
{
|
{
|
|
|
FILE *fd;
|
FILE *fd;
|
int c;
|
int c;
|
int i = 0;
|
int i = 0;
|
|
|
if(argc < 2) {
|
if(argc < 2) {
|
printf("no input file specified\n");
|
printf("no input file specified\n");
|
exit(1);
|
exit(1);
|
}
|
}
|
|
|
fd = fopen( argv[1], "r" );
|
fd = fopen( argv[1], "r" );
|
|
|
while ((c = fgetc(fd)) != EOF) {
|
while ((c = fgetc(fd)) != EOF) {
|
printf("%.2lx", c);
|
printf("%.2lx", c);
|
if (++i == BREAK) {
|
if (++i == BREAK) {
|
printf("\n");
|
printf("\n");
|
i = 0;
|
i = 0;
|
}
|
}
|
}
|
}
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.