I am struggling to get an input file to work. I am very new to programming. I am using Xcode 5.1.1 and trying to use text editor for my input file. As best as I can tell the text editor uses .rtf file.
1. I would like to be able to switch the type of file from .rtf to .txt?
2. When I run the code the output does not show the file info it show 0 program ended with exit code: 0.( The input file has the number 42 in it.) and the output file shows a number 1. How can i get the file into Xcode?
#include <iostream>
#include <fstream>
using namespace std;
int main(){
ifstream fin;
ofstream fout;
int i;
fin.open("input12345.rtf");
fout.open("output12345.rtf");
fin >> i;
cout << i << endl;
fout << i+1;
fin,close();
fout.close();
return 0;
}
you have fin,close() instead of fin.close(). I don't know if that was a copy error or if you have that in your program. I don't think that it will help much with the problem you are having.