void __fastcall TForm1::Button1Click(TObject *Sender)
{
char end='\0';
char *char_v="C:";
char *info_a="C:\\Program Files\\Embarcadero\\Studio\\18.0\\Path-After-Install.txt";
char *info_b="C:\\Program Files\\Embarcadero\\Studio\\18.00\\Path-Before-Install.txt";
FILE *before_path_file,*after_path_file;
size_t bytes_val[2];
char buf_after[512],buf_before[512];
char *temp_after,*temp_before;
char *info_after,*info_before;
after_path_file=fopen(info_a,"r");
bytes_val[0]=fread(buf_after,1,sizeof(buf_after),after_path_file);
if(bytes_val[0]==0)
{
UnicodeString info; info=info_a;
ShowMessage("Error! Can't open file"+info);
}
buf_after[bytes_val[0]]=end;
temp_after=strstr(buf_after,char_v);
sscanf(temp_after,char_v,"%s",info_after);
before_path_file=fopen(info_b,"r");
bytes_val[1]=fread(buf_before,1,sizeof(buf_before),before_path_file);
if(bytes_val[1]==0)
{
UnicodeString info; info=info_b;
ShowMessage("Error! Can't open file"+info);
}
buf_before[bytes_val[1]]=end;
temp_before=strstr(buf_before,char_v);
sscanf(temp_before,char_v,"%s",info_before);
Edit1->Text=info_before;
Edit2->Text=info_after;
}
Brak komentarzy:
Prześlij komentarz