📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "stdio.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void SaveTo(AnsiString FileName1)
{
Application->ProcessMessages();
int i;
FILE *file1;
char *FileName=FileName1.c_str();
file1=fopen(FileName,"wb");
fprintf(file1,"%02x %02x %02x %02x",1,3,5,7);
fclose(file1);
}
void __fastcall TForm1::Button3Click(TObject *Sender)
{
if(SaveDialog1->Execute())
{
SaveTo(SaveDialog1->FileName);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
Application->ProcessMessages();
int i;
int cunt=0;
char *a;
int num;
int aa[40];
char c[1000];
String str;
String strT;
String strHold;
String strbuf[200];
//unsigned
char enter[2];
char temp[4];
//char te='';
FILE *file3;
// char *FileName=OpenDialog1.c_str();
char *FileName="D:/22.bin";
file3=fopen(FileName,"rb+");
rewind(file3);
enter[0]='\r';
enter[1]='\n';
// fseek(file3,430938L,1);
// for(int i=0;i<32;i++)
// {
// aa[i]=18;
// }
for(i=0;i<1000;i++)
{
c[i]=fgetc(file3);
}
str=c;
// temp[0]='0';
// temp[1]='1';
// temp[2]='6';
// temp[3]='e';
//strcpy(str.c_str(),temp);
for(i=0;i<1000;i++)
{
if(c[i]=='\n')
{
strT=str.SubString(i-4,i+1);
strbuf[cunt]=str.SubString(i-4,4);
cunt++;
}
}
Label1->Caption =strbuf[0]+"UU"+strbuf[1]+"UU"+strbuf[2]+"UU"+strbuf[3]+"UU"+strbuf[4]+"UU"+strbuf[5]+"UU"+strbuf[6];
Label2->Caption =strbuf[164]+"UU";
for(i=0;i<=65;i++)
{
str="0x"+strbuf[i];
num=str.ToInt();
strHold =strHold+num+"\r\n";
}
Memo1->Text=strHold;
// str=temp;
//str="abcd";
//strT=str.SubString(0,3);
//str=str+temp;
// str="00b6";
// str="0x"+str;
// str=str.SubString(1,6);
// num=str.ToInt();
// str=num;
// str=str+enter;
// Label2->Caption =str;
// if(c[6]=='0')
// {
// Label2->Caption ="mm";
// }
// else
// {
// Label2->Caption ="jj";
// }
//str=IntToStr(aa);
// strcpy(str,aa);
// Memo1->Text=c;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -