Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I replace bytes in file
Message
From
02/11/2005 12:16:26
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01064533
Message ID:
01064551
Views:
61
Privet Sergey!

Thanks for reply...
As I right understand it might looks like

lcBinary = FILETOSTR(lcFilename)
IF ASC(LEFT(lcBinary,1))=0xFF AND ASC(SUBSTR(lcBinary,2,1))=0xD8
lcBinary = CHR(0x45)+CHR(0x50)+SUBSTR(lcBinary,3,LEN(lcBinary))
STRTOFILE(lcBinary,lcFilename)
ENDIF

Am I right?




>>I need to replace first bytes in the file (FF D8) to (45 50)
>>This is seems blank in my education ;)
>>Can you study me next:
>>
>>1) How to check - is first byte is FF and second is D8. FGETS() ?

>
>lcByte1 = FREAD(lhFileIn,1)
>IF ASC(lcByte1) = 0xFF
>  lcByte2 = FREAD(lhFileOut,2)
>  IF ASC(lcByte2) = 0xD8
>    ...
>
>>2) How to replace one byte to another in file and save it?
>
>Write out to another temp file using FREAD() and FWRITE() and than delete original and rename temp.
>
>IF file is not big, you can use FILETOSTR() and STRTOFILE() to do all that in the memory.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform