📄 hex2c.cpp
字号:
//////////////////////////////////////////////////////////////////////
//
// File: hex2c.c
// $Archive: /USB/Util/hex2c/hex2c.c $
//
// Purpose:
// Utility to convert Intel Hex flies into C source code
//
// Environment:
//
// $Author: o4icwin $
//
//////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream.h>
void main()
{
char *str=(char *)malloc(1000);
///char ch;
FILE *fp=fopen("ex6.hex","r");
FILE *fp2=fopen("ex6.dat","w");//NULL ;
int i=0;
int j=1;
fgets(str,2,fp);
cout<<str<<endl;
//cout<<"iio";//str;//<<endl;
fgets(str,2,fp);
cout<<str<<endl;
while (!feof(fp))
{
fgets(str,2,fp);
if (*str==10)
{
j--;
}
// ch=*str;
if(j%6==1)
{fputs("0x",fp2);
fputs(str,fp2);
}
if(j%6==2)
{
fputs(str,fp2);
}
if(j%6==3)
{
// fputs(str,fp2);
}
if(j%6==4)
{
fputs(str,fp2);
}
if(j%6==5)
{
fputs(str,fp2);
}
if(j%6==0)
{
fputs(",",fp2);
if (i>11)
{fputs("\n",fp2);//change line
//fputs("",fp2);//change line
i=0;//recounter
}
i++;
}
j++;
}
fclose(fp);
fclose(fp2);
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -