function SaveBMPs lparameters tcTable, tcField, tnRecNo, tcOutFileName * tcTable - Tablename containing BMP gen field * tcField - Gen field name * tnRecNo - recno no extract * tcOutFileName - path and fielname of output filename except .BMP extension (no check) local handle, handleout, lcTable lcTable = "T"+sys(2015) select &tcField from (tcTable) ; where recno() = tnRecNo ; into table (lcTable) use handle=fopen(lcTable+".fpt") handleout=fcreate(tcOutFileName+".bmp") lnSize = fseek(handle, 0, 2) && Seek to eof and get size =fseek(handle,599) && Go to start of gen file if ( lnSize - 599 ) % 2 = 0 && Might it be a duplicate ? Let's check lcFirst = fread(handle, (lnSize - 599)/2) && Read first part to lcFirst lcSecond = fread(handle, lnSize) && Read rest to lcSecond && lnSize is totlen && but fread() would stop at feof() =fwrite(handleout, lcFirst, lnSize) && Again lnSize is bigger but && correct size would be written if lcFirst # lcSecond && It was not a duplicate, so write lcSecond too =fwrite(handleout, lcSecond, lnSize) endif else =fwrite(handleout, ; fread(handle,lnSize), ; lnSize) && Since now we have a size at hand. && So let's do readwrite in one pass endif =fclose(handle) =fclose(handleout) erase (lcTable+".*")599 and data might be doubled aren't my self ideas. I got them from MS KB :)