|
대박왕 님이 쓰신 글 :
: 프로젝트 전체파일과 프로그램에 사용된 데이타 파일을 파일로 첨부해서 올려 놓으면
: 고수분들 께서 쉽게 버그를 잡아낼 수 있지 않을까요? 딸랑 소스 일부분만 올리면 문제를
: 어떻게 찾아 낼수 있겠어요
이폼에서만 문제가 있을 수 있다는 생각에서 올렸는데..
아 생각해보니 다른분 보는 시각에서 난해할 수 있었겠네요~ 죄송합니다;
코드를 줄여가며 해보니 에러가 안나는 걸봐서 다른 폼에 문제가 있을 수 있겠네요 ~;
성급한 질문 죄송합니다~;
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Download(void)
{
unsigned char buff[16]; //buffer size [16]
int start, end, size, cnt = 0;
TFileStream* fs = new TFileStream("C:\\abc.dat", fmOpenRead);
start = 0;
end = 1024;
fs->Seek(start, soFromBeginning);
while(true) {
size = fs->Read(buff, 16);
start += size;
if(size == 0) break;
cnt++;
SG->Cells[0][SG->RowCount-1] = IntToStr(cnt); //cnt
SG->Cells[1][SG->RowCount-1] = IntToStr(buff[0]); //speed
SG->Cells[2][SG->RowCount-1] = IntToStr((buff[2]<<8)+buff[1]); //rpm
SG->Cells[3][SG->RowCount-1] = IntToStr(buff[3]); //aux
SG->Cells[4][SG->RowCount-1] = IntToStr((buff[5]<<8)+buff[4]); //
SG->Cells[5][SG->RowCount-1] = IntToStr((buff[9]<<24)+(buff[8]<<16)+(buff[7]<<8)+buff[6]); //
SG->Cells[6][SG->RowCount-1] = IntToStr((buff[13]<<24)+(buff[12]<<16)+(buff[11]<<8)+buff[10]); //
SG->Cells[7][SG->RowCount-1] = IntToStr((buff[15]<<8)+buff[14]); //
if(start >= end) break;
SG->RowCount++;
}
delete fs;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Download();
}
//---------------------------------------------------------------------------
|