How to read HGT files in C++
问题 I'm trying to read the elevation data stored in HGT files. As far as I know they can be read as binary files. I found this thread: How do I access .HGT SRTM files in C++? Based on that post, my sample code is: #include <iostream> #include <fstream> int main(int argc, const char * argv[]) { std::ifstream::pos_type size; char * memblock; std::ifstream file ("N45W066.hgt", std::ios::in|std::ios::binary|std::ios::ate); if (file.is_open()) { size = 2; memblock = new char [size]; file.seekg(0, std: