Skip to content

Instantly share code, notes, and snippets.

@sbchisholm

sbchisholm/test.cpp

Created Jan 9, 2015
Embed
What would you like to do?
#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