View Single Post
Old Jan 10th, 2007, 12:48 PM   #4
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Where is the namespace std after cin? You have to use std::cin if you don't directly state that you are 'using namespace std'. And also, where is your include statement, cin is located in the iostream header!

#include <iostream>
#include <string>
#include <fstream>

int main()
{
	std::string filename, contents = "";
	std::cin >> filename;
	std::ifstream if(file);
	while(std::getline(if, contents))
		contents += contents + "\n";
	//do something with contents
}
I am pretty new to C++ but I think this should compile and work.
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote