displaying formation from a file

i am trying to get data from a txt filed named musicfile.txt to display on a screen and get sent to the printerfile created. when i excecute the program no information is show, could someone tell me whats wrong?

//Program to read from the datafile and print a report
using namespace std;
#include<iostream>
#include<fstream>
#include<iomanip>
//function prototypes
void Initialize(fstream&datafile,fstream&printerfile);
void Readandprint(fstream&datafile,fstream&printerfile);
void Finalize(fstream&datafile,fstream&printerfile);

int main()
{
fstream Musicfile;
fstream printfile;
Initialize(Musicfile,printfile);
Readandprint(Musicfile,printfile);
Finalize(Musicfile,printfile);
}//main

void Initialize(fstream&musicfile,fstream&printerfile)
{
char Musicfile[100];
char printfile[25];
musicfile.open(Musicfile,ios::in);
printerfile.open(printfile,ios::out);
}

void Readandprint(fstream&Musicfile,fstream&printerfile)
{
char artist[20];
int cost;
Musicfile>>artist>>cost;
while(!Musicfile.eof())
{
Musicfile>>artist;
Musicfile>>cost;
printerfile<<setw(5)<<artist<<setw(5)<<cost<<endl;

}//while
}//Readandprint

void Finalize(fstream&Musicfile,fstream&printerfile)
{
Musicfile.close();
printerfile.close();
}//finalize
Nowhere do you define the contents of Musicfile, so musicfile.open(Musicfile,ios::in); does nothing.
Topic archived. No new replies allowed.