How can i convert char to string in here?

I tried this method.This is working:
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include <stdlib.h>
#include <sstream>
using namespace std;
int main(){
int a=6789;
stringstream c;
c<<a;
cout<<c.str()<<endl;
system("PAUSE");
return 0;
}


But i tried in here.It doesn't work:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <stdlib.h>
#include <sstream>
using namespace std;
template<class Conv>
Conv Convert(Conv a){
      stringstream b;
      b<<a;
      return b.str();
      }
int main(){
int a=6789;
cout<<Convert(a)<<endl;
system("PAUSE");
return 0;
}


It's just a typo. The return type should be std::string, of course.
How can i write?
Topic archived. No new replies allowed.