Input file not being created unlike outputfile

Sorry to bug you guys with another different question. Having same problems for my output. First, I really need help getting answer for this question. This is the second straight assignment I have had problems making an inputfile.

This is pretty self explanatory as im making an input and an output file. When I run this program my output file always gets created, but not my input file. I have to manually go to my folder and make that. Why is that?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
	//Make an input file
	//Note: filename is a string variable. Suppose user enters in myname.txt hello. I want to get rid of hello? and possibly not use hello to get stored in variable filename2. How can I?
	cout<<"Enter Input File name: ";
	cin>>filename;

	

	//Convert the file in to c string
	in.open(filename.c_str());

	//make an output file
	cout<<"\nEnter Output File Name: ";
	cin>>filename2;
	out.open(filename2.c_str());


}
This is pretty self explanatory as im making an input and an output file. When I run this program my output file always gets created, but not my input file. I have to manually go to my folder and make that. Why is that?


Would it make sense for your program to automagically create an empty input file with nothing in it to extract for input? If you open a file for input, you expect the file to already exist with data in it.
Lol makes much more sense now...Got my confusion cleared up!!!
Topic archived. No new replies allowed.