/** This code snippet was taken from freecodesnippets.com*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in("test", ios::in | ios::binary);
if(!in) {
cout << "Cannot open input file.\n";
return 1;
}
double num;
char str[80];
in.read((char *) &num, sizeof(double));
in.read(str, 14);
str[14] = \0; // null terminate str
cout << num << << str;
in.close();
return 0;
}
No replies to this topic
#1
Posted 25 January 2010 - 07:48 PM
C++ Read File Content
|
|
|
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









