No help, I've tried several solutions and it's not happening. Maybe the file is corrupted. I'm going to try to get another file.
John
>John,
>
>I've never seen this problem with the strtofile/filetostr functions. Are you sure these are the only things you are using? What else is in 123.jpg since you are initially appending to it in your code below? This code works fine for me:
>
>
>lcFile = filetostr( "x.jpg" )
>strtofile( lcFile, "xplus.jpg" )
>strtofile( lcFile, "xplus.jpg", 1 )
>
>lcRead = filetostr( "xplus.jpg" )
>? len( lcRead )
>
>i = at( chr(0xff) + chr(0xd9), lcRead )
>
>lcOne = left( lcRead, i+1 )
>lcTwo = substr( lcRead, i+2 )
>
>? lcFile == lcOne
>? lcFile == lcTwo
>? lcOne == lcTwo
>
>strtofile( lcOne, "xread1.jpg" )
>strtofile( lcTwo, "xread2.jpg" )
>
>
>then I viewed each of the output jpgs in IE and they all display the same. The xplus.jpg only shows one image so i probably terminates it's read at the EOI marker.
>
>What differences are you seeing in the files? At what offsets in the files?
>
>>I've got a small problem trying to reconstruct a jpg file from a single stream text file. VFP appears to be adding some chars to the mix. To test this hypothesis, I took a good jpg file and read it in to a var using filetostr.
>>
>>lcfile=filetostr('x.jpg')
>>Then I created another file using
>>strtofile(lcfile,'123.jpg',1)
>>strtofile(lcfile,'123.jpg',1)
>>strtofile('this is garbage','123.jpg',1)
>>
>>I would have thought I should be able to write a routine that looked for the jpeg's (SOI) Start of Image [ÿØÿà] and (EOI) End of Image [ÿÙ] and pull the image from the stream. However, this is not working. Even if I get a string using the above search criteria, VFP is adding to the mix.
John Harvey
Shelbynet.com
"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright