Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WriteToFile?

Status
Not open for further replies.

soks2626

Programmer
Jul 3, 2002
22
US
Hi again-
I was wondering how I would be able to take a Binary piece of data (like an image stored in a table) and write that to a specific directory and file name based on other contents on the same row as that image data. I'm thinking "WriteToFile", but that doesn't seem to let me write to a specific place or let me specify how I want the file to be named.

Any suggestions? Thanks!

-Alex
 
Alex,

Something like this should work:

Code:
method pushButton(var eventInfo Event)
var
   binDocData   Binary            
   tcDocTable   TCursor           
endVar

const
   BLOB_TABLE = ":work:blobdemo"
endConst


   if not tcDocTable.open( BLOB_TABLE ) then
      errorShow( "Can't Open " + BLOB_TABLE,
                 "Use [>>] for more details." )
   else

      ; Now, write the binary data to the file
      binDocData = tcDocTable."BlobData"
      binDocData.writeToFile( "c:\\myblob.bin" )

   endIf

   ; Note: Always explicitly close TCursors
   if tcDocTable.isAssigned() then
      tcDocTable.close()
   endIf

endMethod

Hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top