class Class1
{
/* static int ReverseBytes(int val)
{
return (val & 0x000000FF) << 24 |
(val & 0x0000FF00) << 8 |
(val & 0x00FF0000) >> 8 |
((int)(val & 0xFF000000)) >> 24;
} */
static void Main(string[] args)
{
int b = 0;
using (FileStream fs = new FileStream("N53E028.hgt", FileMode.Open, FileAccess.Read))
{
int counter = 0;
for (int i = 0; i <300; i += 2)
{
var buf = new byte[2];
var buf2 = new byte[2] { buf[1], buf[0] };
fs.Read(buf, 0, 2);
var val = (BitConverter.ToInt16(buf2, 0));
// ReverseBytes(val);
Console.Write(val.ToString() + " ");
if (counter % 16 == 0)
{
Console.WriteLine();
}
counter++;
}
// } while (b != -1);
Console.ReadKey();
}
}
}
class Class1
{
static int ReverseBytes(int val)
{
return (val & 0x000000FF) << 24 |
(val & 0x0000FF00) << 8 |
(val & 0x00FF0000) >> 8 |
((int)(val & 0xFF000000)) >> 24;
}
static void Main(string[] args)
{
int b = 0;
using (FileStream fs = new FileStream("N53E028.hgt", FileMode.Open, FileAccess.Read))
{
int counter = 0;
for (int i = 0; i <300; i += 2)
{
var buf = new byte[2];
fs.Read(buf, 0, 2);
var val = (BitConverter.ToInt16(buf, 0));
// ReverseBytes(val);
Console.Write(val.ToString() + " ");
if (counter % 16 == 0)
{
Console.WriteLine();
}
counter++;
}
// } while (b != -1);
Console.ReadKey();
}
}
}