- #1
Sumaya
- 29
- 0
Homework Statement
I am working in visual 2008 c++ ... The is an errors on error C2664: 'std::basic_istream<_Elem,_Traits> &std::basic_istream<_Elem,_Traits>::get(_Elem &)' : cannot convert parameter 1 from 'char [20]' to 'char &'
Homework Equations
The Attempt at a Solution
Code:
#include "stdafx.h"
// Assignment I files.cpp : Defines the entry point for the console application.
//
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
struct person
{
char name[20];
int id;
};
void main()
{
//3.
char c[20];
int y;
ifstream infile("person.txt");
for(int i=0;i<5;i++)
{
infile>>c>>y;
cout<<c<<" "<<y<<endl;
}
//4.
infile.seekg(8L,ios::beg);
infile>>c>>y;
cout<<c<<" "<<y;
while(infile.peek()!=EOF)
{
infile.get(c);
cout<<c;
}
infile.close();
}