Server Help

Non-Subspace Related Coding - getline() with visual c++

hellzlaker - Fri Dec 05, 2008 4:46 pm
Post subject: getline() with visual c++
Code: Show/Hide
#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;

int main()
{
   string buf;
   cout<<"Enter a string: ";
   getline(cin,buf);

   system("pause");
}


In dev-c++ this would compile fine but visual c++ tell me getline() is undefined... I googled and found nothing, and I'm not talking about cin.getline(), I'm talking about getline(cin,buffer), any clue?
hellzlaker - Fri Dec 05, 2008 4:52 pm
Post subject:
nevermind, the problem was it needs to be #include <string> not <string.h>
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group