> Getline from file stream in c++?

Getline from file stream in c++?

Posted at: 2014-12-18 
I think I figured it out. Can't store it immediately, I was trying

allListings[count].company = getline(inputFile, name);

For some reason that doesn't work, but breaking it up into two lines does.

Yes but it's for strings... you said you knew how to use getline but your example shows you trying it with an int...

get the line into a string and you can use stringstream to convert to other formats if you choose.

http://www.cplusplus.com/doc/tutorial/fi...

I'm aware of how to use getline for iostream, such as getline(cin, myint);

I want to extract from an ifstream file stream variable up until a newline character is encountered, much like with cin and getline.

But going(my file variable is inputFile)

getline(inputFile, companyName) doesn't work. Can getline be used with file stream varibiables? How?