I
IsRaEl
Hello,
I've neve done BinaryWriting, but i need to generate TomTom and
Destinator files from a POI database.
I manage to get this specification over the internet, but i'm having
troubles to generate the file
// An OV2 file consists of POI records. Each record has the following
data format.
// 1 BYTE, char, POI status ('0' or '2')
// 4 BYTES, long, denotes length of the POI record.
// 4 BYTES, long, longitude * 100000
// 4 BYTES, long, latitude * 100000
// x BYTES, string, label for POI, x == total length – (1 + 3 * 4)
including terminating 0.
Here is the code i'm trying to make it work.
FileStream fs = File.Create("C:\\test.dat");
BinaryWriter bw = new BinaryWriter(fs);
char ini= (char)0x02;
long a = "40 km/h".Length + 20;
long b = (long)(-46.75068 * 100000);
long c = (long)(-23.50811 * 100000);
string d = "40 km/h";
char end = (char)0x00;
bw.Write(ini);
bw.Write(a);
bw.Write(b);
bw.Write(c);
bw.Write(d);
bw.Write(end);
bw.Close();
fs.Close();
Is there anyway to get a diferent result, since i'm a newbie in binary
files??
Thanks in advance..
I've neve done BinaryWriting, but i need to generate TomTom and
Destinator files from a POI database.
I manage to get this specification over the internet, but i'm having
troubles to generate the file
// An OV2 file consists of POI records. Each record has the following
data format.
// 1 BYTE, char, POI status ('0' or '2')
// 4 BYTES, long, denotes length of the POI record.
// 4 BYTES, long, longitude * 100000
// 4 BYTES, long, latitude * 100000
// x BYTES, string, label for POI, x == total length – (1 + 3 * 4)
including terminating 0.
Here is the code i'm trying to make it work.
FileStream fs = File.Create("C:\\test.dat");
BinaryWriter bw = new BinaryWriter(fs);
char ini= (char)0x02;
long a = "40 km/h".Length + 20;
long b = (long)(-46.75068 * 100000);
long c = (long)(-23.50811 * 100000);
string d = "40 km/h";
char end = (char)0x00;
bw.Write(ini);
bw.Write(a);
bw.Write(b);
bw.Write(c);
bw.Write(d);
bw.Write(end);
bw.Close();
fs.Close();
Is there anyway to get a diferent result, since i'm a newbie in binary
files??
Thanks in advance..