Ok, I am trying to learn other types of functions, because all I knew how to do was inline functions. Anyway, in the process of rewriting an app I made, I am having problems I don't understand at all.
Originally Posted by
Dev-C++ 5
C:/Dev-Cpp/include/c++/3.4.2/bits/ios_base.h: In copy constructor `std::basic_ios<char, std::char_traits<char> >::basic_ios(const std::basic_ios<char, std::char_traits<char> >&)':
C:/Dev-Cpp/include/c++/3.4.2/bits/ios_base.h:738: error: `std::ios_base::ios_base(const std::ios_base&)' is private
NewMain.cpp:28: error: within this context
C:/Dev-Cpp/include/c++/3.4.2/streambuf: In copy constructor `std::basic_filebuf<char, std::char_traits<char> >::basic_filebuf(const std::basic_filebuf<char, std::char_traits<char> >&)':
C:/Dev-Cpp/include/c++/3.4.2/streambuf:769: error: `std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits = std::char_traits<char>]' is private
NewMain.cpp:28: error: within this context
NewMain.cpp: In function `int main()':
NewMain.cpp:28: error: initializing argument 1 of `int loadfile(std::ifstream)'
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int loadfile(ifstream file);
int main ()
{
cout<<"Welcome to TodesRunes 1.1!"<<endl;
int iRun = 1; //menu choice
int iCubed = 0; //if the cubing function has been called
const int iNumOfRunes = 33;
int aiRunes1[iNumOfRunes] = {0};
int aiRunes2[iNumOfRunes] = {0};
const string sRuneNames[iNumOfRunes] = {"El", "Eld", "Tir", "Nef", "Eth", "Ith",
"Tal", "Ral", "Ort", "Thul", "Amn", "Sol",
"Shael", "Dol", "Hel", "Io", "Lum", "Ko",
"Fal", "Lem", "Pul", "Um", "Mal", "Ist",
"Gul", "Vex", "Ohm", "Lo", "Sur", "Ber",
"Jah", "Cham", "Zod"};
ifstream file; //ATMA dump
ofstream save; //TodesRune dump
loadfile(file); //loads the ATMA dump
}
int loadfile(ifstream file)
{
file.open("Runes.txt");
if (!file.is_open())
file.open( "runes.txt");
if (!file.is_open())
file.open( "rune.txt");
if (!file.is_open())
file.open( "Rune.txt");
if (!file.is_open())
while(!file.is_open())
{
string filename;
cout<<"TodesRunes could not find your ATMA dump,"<<endl
<<"please specify the path to the txt file."<<endl;
getline(cin,filename);
file.open(filename.c_str());
}
return 0;
}
Thank you
~Wraith