-1

次のエラーが表示されます。

エラー 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;

}

私は何をすべきか?

4

1 に答える 1

5

c_strのメンバー関数なstd::stringので、次のように呼び出す必要があります()

gcnew System::String(converter.str().c_str());
//                                        ^^ HERE!
于 2013-09-29T14:22:31.660 に答える