Re: [Dev-C++] Input one file output another.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2002-10-24 09:43:36
|
This constructor may help
fstream( const char* szName, int nMode, int nProt = filebuf::openprot );
szName is the name of the file,
nMode is ios::in, ios::out etc.
then use
filebuf::sh_read (Read sharing allowed.)
and
filebuf::sh_write (Write sharing allowed.)
with the || operator.
Try closing the file as well once you are done with it.
>From: "Mitchell, Tamra (DLM)" <Tam...@dl...>
>To: "'dev...@li...'"
><dev...@li...>
>Subject: [Dev-C++] Input one file output another.
>Date: Wed, 23 Oct 2002 14:54:20 -0400
>
>
>Rephrase question.
>
>I am trying read test from one file and output to another file and am not
>sure how to complete correctly.
>
>#include<fstream>
>#include<iostream>
>using namespace std;
>
>void main(){
> ifstream fin;
> ofstream fout;
> fin.open("Eb.txt");
> /*if(fin==0){
> cout << " input file xx.txt not found "<< endl;
> }*/
> fout.open("y.txt");
> int a[10],i;
> for(i=0;i<10;i++)
> fin >> a[i];
> for(i=0;i<10;i++)
> fout << a[i] << endl;
>
>}
>
>
>Can anyone offer any suggestions.
>
>Tamra Y. Mitchell
>Database & Operating Systems Analyst
>412-222-8203 - Work
>412-996-9078 - Cell
>
_________________________________________________________________
Surf the Web without missing calls! Get MSN Broadband.
http://resourcecenter.msn.com/access/plans/freeactivation.asp
|