I am writing a program that reads in a file and converts the data to a different format. I am having issues with using the end of file function. The program compiles with out any error but when I run it I think it gets stuck in an infinite loop. Can anyone tell me what I am doing wrong? I am just learning C++ so any and all advice is appreciated!
Edit: Also, when I uncomment the infile.get and infile.getline I get a ton of error messages. The first one is:
* Created by on 6/22/10.
* Copyright 2010 __MyCompanyName__. All rights reserved.
int main(const int argc, const char** argv)
const char* c_str();
suffix = ".pdb";
// Get filename and open stream
std::cout << "Enter filename:\n";
std::cin >> filename;
std::cout << "Opening " << filename << "...\n";
// Create RasMol file and open stream
RasFile = filename + suffix;
std::cout << "Output will be to file " << RasFile << "\n";
int index = 1;
if (ch == 'm')
infile >> x >> y >> z;
outfile << "ATOM " << index;
RasMolMaker.cpp:35: error: no matching function for call to ‘std::basic_ifstream<char, std::char_traits<char> >::get(char&, int)’
/usr/include/c++/4.2.1/istream:292: note: candidates are: typename std::basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::get()
[with _CharT = char, _Traits = std::char_traits<char>]