|
엔테라 미들웨어의 어프리케이션 서버에서
이미지 파일를 넘겨받아 클라이언트에 저장하는 프로그램입니다
서버측 프로그램
long f_img_download (char *fn, char **image)
{
FILE *fp, *out;
long fl, nbyte;
char filename[50];
strcpy(filename,fn);
if((fp = fopen(filename, "rb")) == NULL)
return -1;
fseek(fp, 0L, SEEK_END);
fl = ftell(fp); /* get file length */
fseek(fp, 0L , SEEK_SET); /* move start point */
*image = (char*) dce_malloc (fl);
nbyte = fread (*image, fl, 1, fp);
fclose (fp);
return fl;
}
와 같습니다
그런데 이것을 make 하여 P/B 함수 파일과 C빌더에서 사용하기위한
헤더파일, C 파일을 만들어 include 하여 사용 하였는데
파워빌더 에서는 이미지 파일이 잘 다운로드 되는데
C빌더에서는 이미지가 다운로드 되지 않습니다
도저히 원인을 알수가 없군요...
아무래도 C 빌더의 클라이언트 문제 같은데
특별히 고려 해야될 사항이 있나여
밑에는 프로그램은 C 빌더내에서 사용하는 루틴입니다
void __fastcall TForm1::Download(AnsiString fName, AnsiString hull_no)
{
AnsiString path_name;
double rv_size, rt_size;
char *image;
int iFileHandle, imgHandle;
path_name = path;
path_name = path_name.Insert(hull_no,path_name.Length()+1);
path_name = path_name.Insert("/",path_name.Length()+1);
fName = UpperCase(fName);
//엔테라 에서 만든 함수를 인클루드 해서 사용
rv_size = f_img_download((path_name+fName).c_str(),
&image);
StatusBar1->Panels->Items[0]->Text = fName;
if(rv_size <1) {
ShowMessage("이미지 다운로드 실패!!!");
Screen->Cursor = crDefault;
return;
}
else {
if (FileExists(fName)) //파일 덮어쓰기
{
imgHandle = FileOpen(fName, fmOpenWrite);
rt_size = FileWrite(imgHandle, image, rv_size);
FileClose(imgHandle);
}
else { //새로운 이미지 파일 생성
iFileHandle = FileCreate(fName);
rt_size = FileWrite(iFileHandle, image, rv_size);
FileClose(iFileHandle);
}
}
Screen->Cursor = crDefault;
}
|