confused with working with <fstream>

So i have to make a program that taken in 12 temperatures and it will write out to "tempdat.dat" and the temperatues will be displayed vertically and the difference of the temperature from the previous day is listed to the right. so far im jsut concerned with getting the temperatures in and then being listed. this is what i have so far

#include <iostream>
#include <fstream>
using namespace std;

void main()
{
ifstream infile;
ofstream outfile;
float one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve;
infile.open("temp.dat");
outfile.open("tempdata.dat");

infile >> one >> two >> three >> four >> five >> six >> seven >> eight >> nine >> ten >> eleven >> twelve;
outfile << one << endl >> two << endl >> three << endl >> four << endl >> five << endl >> six << endl >> seven << endl >> eight << endl >> nine << endl >> ten << endl >> eleven << endl >> twelve << endl;
infile.close("temp.dat");
outfile.close("tempdata.dat");
return 0;

}

but Im getting a bunch of errors like this:
1>c:\users\jon\documents\visual studio 2008\projects\hw2\hw2\hw2.cpp(14) : error C2784: 'std::basic_istream<char,_Traits> &std::operator >>(std::basic_istream<char,_Traits> &,unsigned char &)' : could not deduce template argument for 'std::basic_istream<char,_Traits> &' from 'std::basic_ostream<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\istream(1021) : see declaration of 'std::operator >>'
1>c:\users\jon\documents\visual studio 2008\projects\hw2\hw2\hw2.cpp(14) :

can anyone please help me?
You can only << to output streams, and you can only >> from input streams.
ok so i fixed that and now im getting two C2660 errors:

1>c:\users\jon\documents\visual studio 2008\projects\hw2\hw2\hw2.cpp(16) : error C2660: 'std::basic_ifstream<_Elem,_Traits>::close' : function does not take 1 arguments
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1>c:\users\jon\documents\visual studio 2008\projects\hw2\hw2\hw2.cpp(17) : error C2660: 'std::basic_ofstream<_Elem,_Traits>::close' : function does not take 1 arguments
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]

how do i fix that
You don't need to supply the name of the file to close to .close().
great, that did the trick, thanks for the help
Topic archived. No new replies allowed.