Hello,
I am trying to write my own parser of some binary format. So far I managed to open the file and get all its bytes in to an array. I need somehow start getting values out of it (data).
import System;
import System.IO;
function Start () {
var _mainPath : String = "Assets/HarrisStuff/clouds/";
var _cloudPath : String = Path.Combine(_mainPath,"cloud0.dat");
//Debug.Log(_cloudPath);
if (File.Exists(_cloudPath) )
{
var data : byte[];
data = File.ReadAllBytes(_cloudPath);
print(data.length);
}
else
{
Debug.Log("Invalid file name");
}
//print(File.Exists(_cloudPath));
}
Alternatively I am looking for smth fimilar to fread function. So I could parse it.In other words how can I do this in Jscript:
fread(&MyVariable, sizeof(SomeDataType), 1, the file);