In article <3HHdf.9457$8R6.871@newsfe1-gui.ntli.net>,
John Harrison <john_andronicus@hotmail.com> wrote:[color=blue]
>Gaijinco wrote:[color=green]
>> If I want to get input from a file I use:
>>
>> #include <fstream>
>>
>> int main(){
>>
>> ifstream input("file.in",ios::in);[/color]
>
>ios::in is not necessary.
>[color=green]
>>
>> int x;
>> input >> x;
>>
>> }
>>
>> What about if I want to output to a file?
>>[/color]
>
>Very similar
>
>int main()
>{
> ofstream output("file.out");
> int x = 42;
> outupt << x;
>}
>
>Basically use ofstream instead of ifstream and << instead of >>.[/color]
Gaijinco, PLEASE get yourself a good reference.
See
http://www.comeaucomputing.com/booklist for some suggestions.
--
Greg Comeau / Celebrating 20 years of Comeauity!
Comeau C/C++ ONLINE ==>
http://www.comeaucomputing.com/tryitout
World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?