Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I replace bytes in file
Message
 
 
To
02/11/2005 11:58:28
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:
01064538
Views:
52
This message has been marked as the solution to the initial question of the thread.
>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.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform