#include #include #include /* many other files with this format can be downloaded from http://rabbit.eng.miami.edu/geographical/bintiles/ the names all look a bit like this example usaW105N35D10.dat the "W105N35" indicates that the top left corner corresponds to the point with longitude 105 degrees West and latitude 35 degrees North. the "D10" means it covers an area 10 degrees square, so the bottom right corner is at 95 West and 25 South If you are working on rabbit, you do not need to download any files, you can access them directly using the file name "/home/www/geographical/bintiles/usaW85N30D5.dat" (which contains most of florida) Beware! Many of the files have a 600x600 arrangement, not the 800x800 of the class example one. If you don't correctly adjust the program, the image will be completely wrong. */ void main() { int f = open("mystery.dat", O_RDONLY | O_BINARY); if (f<0) { cout << "no\n"; exit(1); } short int data[800]; for (int line=0; true; line+=1) { int n = read(f, data, 1600); if (n<0) break; if (line%10 != 0) continue; for (int i=0; i<800; i+=10) { bool solid = false; for (int j=0; j<10; j+=1) if (data[i+j]==-500) solid=true; if (solid) cout << "#"; else cout << "."; } cout << "\n"; } close(f); }