Oct 8, 2010 at 8:47pm UTC
Hello all, just wondering if you can help me out here? I was given a specified path which i need to open in binary and put it into an array.
/home/turing/abyrnes/input/cs241/fall10/lincoln
is the path of the binary file
this is what I have written, but i get a ton of errors about "stray /### in program"
#include <fstream>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <math.h>
#include "Name.h"
#include "Date.h"
#include "Person.h"
#include "/home/turing/abyrnes/input/cs241/fall10/lincoln"
using namespace std;
using std::cout;
using std::endl;
int read_persons();
int main()
{
int count = 0;
cout << count;
cout << endl;
count = read_persons();
cout << count;
cout << endl;
return 0;
}
int read_persons()
{
int counts = 0;
int x = 8;
char names[100];
ifstream instream;
instream.open("lincoln.bin", ios::binary);
assert(instream);
while(instream)
{
counts = counts + 1;
instream.read((char *) &names[counts], sizeof names);
cout << names[counts];
cout << endl;
}