Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Extracting Graphic Images from Embedded General Fields
Message
From
19/03/1999 11:49:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/03/1999 15:37:08
Thierry Yuen
Stantec Architecture Ltd.
Calgary, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00195892
Message ID:
00199789
Views:
26
>Well, I've had a little time to look over the code that you kindly posted for me. However, I seem to be running into a problem with the lnSize variable. I continue to receive an insufficient memory error. However, when I remove the lnSize variable replacing it with 65535, the function appears to complete itself but does not write any data to the handleout file. I am a little disgruntled that I am taking so much of your time besides being short on experience in FoxPro. Below is the code that I am currently using and if you do have any further suggestions, I would be happy to hear them.
>
>Thierry
>
>
>lcTable = "T" + sys(2015)
>select PHOTO from "m:\990318.dbf" where recno()=1 into table (lcTable)
>use
>handle=fopen(lcTable+".fpt")
>handleout=fcreate("990318.bmp")
>lnSize=fseek(handle,0,2)
>=fseek(handle,599)
>lcFirst = fread(handle,(lnSize - 599)/2)
>lcSecond = fread(handle,lnSize)
>if (lnSize - 599)%2 = 0
>	=fwrite(handleout,lcFirst,lnSize)
>endif
>if lcFirst # lcSecond
>	=fwrite(handleout,lcSecond,lnSize)
>endif
>if (lnSize - 599)%2 > 0
>	=fwrite(handleout,fread(handle,lnSize),lnSize)
>endif
>=fclose(handle)
>=fclose(handleout)
>erase (lcTable+".*")
>close data
>
Thierry,
Let's take another approach assuming a huge file :
*....
handle=fopen(lcTable+".fpt")
handleout=fcreate("990318.bmp")
=fseek(handle,599)
*No check for duplicate
#define MYSIZE 32*1024
* read&write in 32K blocks
do while !feof(handle)
  =fwrite(handleout,fread(handle,MYSIZE),MYSIZE)
enddo
=fclose(handle)
=fclose(handleout)
erase (lcTable+".*")
close data
PS: I suspect you're using FP2.x standart edition where max string length is 65535.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform