Created
January 9, 2015 13:42
-
-
Save sbchisholm/7e59e579853cc5e1b03d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<fstream> | |
#include<iostream> | |
int main(int argc, char* argv[]) { | |
std::cout << "sizeof(unsigned int)" << sizeof(unsigned int) << std::endl; | |
std::cout << "sizeof(double)" << sizeof(double) << std::endl; | |
if (argc < 2) return -1; | |
std::ifstream stream; | |
std::cout << "file: " << argv[1] << std::endl; | |
stream.open(argv[1], std::ios::in); | |
unsigned int count; | |
stream.read((char*)&count, sizeof(count)); | |
//stream >> count; | |
if (not stream.good()) return -1; | |
std::cout << "count: " << count << std::endl; | |
for (int i = 0; i < 10; ++i) { | |
double d; | |
stream.read((char*)&d, sizeof(d)); | |
//stream >> count; | |
if (not stream.good()) return -1; | |
std::cout << d << std::endl; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment