0

I have to read a file which in .dat format and separate data based on 2 first consecutive zero byte comes. first half is json data and other half is binary data.

How should I go about it?

I tried using NSData dataWithContentsOfFile method and read it and then convert it in byte array and compare bytes. Somehow, its not working.

Cœur
  • 34,719
  • 24
  • 185
  • 251
Snehal Patil
  • 93
  • 3
  • 10

1 Answers1

0

You can use the same kind of procedure that you would use to read a file by lines. Here and here are earlier answers on SO regarding reading a file line-by-line. Just change \n to the byte sequence that is applicable.

Community
  • 1
  • 1
dawg
  • 90,796
  • 20
  • 120
  • 197