Whats wrong with this code?

Anyone?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main () {
 ifstream inputFile;
 string name;
 inputFile.open("filename.dat");
				
 inputFile >> name;

 inputFile.close();
 cout<<name<<endl;
  return 0;
}
You ask the question that we are supposed to ask you.

Why do you think something is wrong with this code?
I have no clue that is why I am asking. It looks right to me and will not run
What do you mean by "will not run"? The code compiles and runs successfully for me.
When I go 2 debug it I get this error Native' has exited with code 0 (0x0)
That's not an error, that's a success. Your program ran so quickly that you didn't even get a chance to see it before it successfully finished and exited.

If you want your program to stop before it ends, read the first two posts here:
http://www.cplusplus.com/forum/beginner/1988/
lol, Thank you
Topic archived. No new replies allowed.