I have a common problem in that I'm trying to output some ole-blobs to files. They are only Word docs or PDFs. The word docs are saving fine but I need to get the OLE wrapper off of the blob. Unfortunately, after examining them with a hex editor the wrapper ends at different spots. Sometimes it's at byte 3072, sometimes 2560 and sometimes at 3580 and perhaps other spots - those are just ones I've found. I know the header of the PDF starts with '%PDF'.
I'm using blobmid to grab the first 5000 characters and then converting to string. But I guess because there are many nulls in the blob the resultant string is only 8 characters long so I can't find the string in it.
If I write the blob out to a temp file and read it back in a chunk at a time can I use POS to find the '%PDF'? I can't seem to find any examples where people have done that and I'm wondering if I'll run into the same problem. So before I start coding, and waste time, I thought I'd see if anyone else has some experience at finding a string in a blob first.
Will that work? Or, is there a better way? Or am I doing something wrong in converting the blob chunk to string? Thanks.