getline with pointer

I Want to know what is the wrong in this code, or which function could I use to get string referred by pointer.

1
2
3
4
5
6
7
8
9
10
11
#include<iostream>
#include<string>
using namespace std;
void main()
{
	char* s;
	cout<<"Enter your string mony amount"<<endl;
	s=new char[20];
	getline(cin,s);
	cout<<s<<endl;
}



You need to use istream::getline(), not std::getline(). See http://www.cplusplus.com/reference/iostream/istream/getline/ .
Thanks Webjose I used istream::getline(), and it works .
Thanks.
Topic archived. No new replies allowed.