我收到以下错误:
错误 C3867:'std::basic_string<_Elem,_Traits,_Ax>::c_str':函数调用缺少参数列表;使用 '&std::basic_string<_Elem,_Traits,_Ax>::c_str' 创建指向成员的指针
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
#using <System.dll>
#include <sstream>
#include <string>
using namespace System::Net;
using namespace std;
int main(array<System::String ^> ^args)
{
int input;
cout << "Welcome to the prize draw!!" << endl;
cout << "Please enter your age - ";
cin >> input;
cin.ignore();
if (input < 13){
cout << "You must be 13 or over to enter" << endl;
}
else
{
cout << "You will now be entered..." << endl;
WebClient^ client = gcnew WebClient;
client->Credentials = gcnew NetworkCredential ("user","pass");
System::String^ num = client->DownloadString("ftp://ftpaddress/code.txt");
ostringstream converter;
int number = int::Parse(num);
int numup = number +1;
converter << (numup);
// I get the error here -
System::String^ newnum = gcnew System::String(converter.str().c_str);
client->UploadString("ftp://ftpaddress/code.txt", newnum);
System::String^ win = client->DownloadString("ftp://ftpaddress/wincode.txt");
if (num == win){
cout << "You have won a prize!!! - " << endl;
int newwin = int::Parse(win) + rand() % (int::Parse(win) * 5);
ostringstream convert;
convert << newwin;
// I get the error here, too -
System::String^ toupload = gcnew System::String(convert.str().c_str);
client ->UploadString("ftp://ftpaddress/wincode.txt",toupload);
}
else
{
cout << "Sorry, you didn't win this time" << endl;
}
}
return 0;
}
我应该怎么办?