cant figure out how to open a file called musicfile

in void initialize i am trying open a datafile to read from and a printerfile for out, i cant figure out what to put in there


//Retrieving information from a data file about cost of musician CD
using namespace std;
#include<iostream>
#include<fstream>
//function prototypes
void Initialize(fstream&datafile,fstream&printerfile);
void Readandprint(fstream&datafile,fstream&printerfile);
void Finalize(fstream&datafile,fstream&printerfile);

main()
fstream Musicfile;
Initialize(musicfile,printerfile);
Readandprint(musicfile,printerfile);
finalize(musicfile,printerfile);
}//main

void Initialize(fstream&Musicfile,fstream&printerfile)
{char datafile[20];

Musicfile.open(Musicfile,ios::in);
}

void Readandprint(fstream&datafile,fstream&printerfile)
{
char artist[25];
int cost;
musicfile>> artist >> cost;
while(!Musicfile.eof())
{ printerfile<< setw(5)<<artist<<setw(5)<<cost<<endl;
}//while
}//readandprint
Your main() function has no type and no opening brace:
1
2
3
4
int main()
{
    // ... your main code here
}
Topic archived. No new replies allowed.