?? unit2.cpp
字號:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include "Unit2.h"
#include "Unit1.h"
#include "Pcomm.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// Important: Methods and properties of objects in VCL can only be
// used in a method called using Synchronize, for example:
//
// Synchronize(UpdateCaption);
//
// where UpdateCaption could look like:
//
// void __fastcall Thread1::UpdateCaption()
// {
// Form1->Caption = "Updated in a thread";
// }
//---------------------------------------------------------------------------
__fastcall Thread1::Thread1(bool CreateSuspended)
: TThread(CreateSuspended)
{
}
//---------------------------------------------------------------------------
void __fastcall Thread1::Execute()
{
int i=0;
unsigned char ch;
try
{
Form1->fp = fopen(Form1->StaticText1->Caption.c_str(), "rb");
fseek(Form1->fp, SEEK_SET, 0);
while(!feof(Form1->fp))
{
sio_putch(Form1->port, ch=fgetc(Form1->fp));
Form1->StaticText2->Caption = ++i;
}
fclose(Form1->fp);
}
catch(...)
{
Application->MessageBox("Can't perform one of the following file operations: Open, Seek, Read, Close.", "File Error", IDOK);
}
}
//---------------------------------------------------------------------------
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -