how to get to your output file after its created?

I'm pretty sure this is right. it worked good when I had it just cout. I changed all the cout to outData and added the outData stuff at the top. my question is how do I view my outData.txt file once its done?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>


using namespace std;

int main()
{
	string filename;
	int a, b, c; // ASCII values for fill character
	int aw, bw, cw; // width values for setwidth
	char ch1, ch2, ch3; // character for right or left justification
	string s1, s2, s3; // strings

	ifstream inData;
	ofstream outData;

	cout << "please enter the location of the file you wish to input: " << endl;
	getline(cin, filename);

	inData.open(filename.c_str());

	outData.open("Last_First_proj1.results.txt");

	
		inData >> a;
		inData.ignore(100, ' ');
		inData >> aw;
		inData.ignore(100, ' ');
		inData >> ch1;
		inData.ignore(100, ' ');
		getline(inData, s1);
		inData >> b;
		inData.ignore(100, ' ');
		inData >> bw;
		inData.ignore(100, ' ');
		inData >> ch2;
		inData.ignore(100, ' ');
		getline(inData, s2);
		inData >> c;
		inData.ignore(100, ' ');
		inData >> cw;
		inData.ignore(100, ' ');
		inData >> ch3;
		inData.ignore(100, ' ');
		getline(inData, s3);
		{
		if  (ch1 == 'l' || ch1 == 'L')
			outData << left;
		else if (ch1 == 'r' || ch1 == 'R')
			outData << right;
		else
			outData << "error" << endl;
		}
		outData << setw(aw) << setfill(char(a)) << s1 << endl;
		{
		if  (ch2 == 'l' || ch2 == 'L')
			outData << left;
		else if (ch2 == 'r' || ch2 == 'R')
			outData << right;
		else
			outData << "error" << endl;
		}
		outData << setw(bw) << setfill(char(b)) << s2 << endl;
		{
		if  (ch3 == 'l' || ch3 == 'L')
			outData << left;
		else if (ch3 == 'r' || ch3 == 'R')
			outData << right;
		else
			outData << "error" << endl;
		}
		outData << setw(cw) << setfill(char(c)) << s3 << endl;

		inData.close();
		outData.close();
	
	return 0;
Last edited on
It should create the text file in the same directory as your executable. Then you just double click it to open like any other file. ( unless mac I think you have to right click. ) You can also search for it inside a folder if you still cant find it.
thanks I found it. I probably should have thought to look there in the first place.
Topic archived. No new replies allowed.