私はC++を初めて使用します。私は次の簡単なコードを書いています。文字[40]を関数に渡して、出力と同じものを取得したかったのです。次の時点でデバッグを行った場合。strcpy_s(x、100、tester);
しかし、「これは出力で送信されます」と書いた場合にのみ「これ」が必要です。誰かが私が欠けているものと、少数の文字しか受け入れない理由を指摘できますか?
// BUSTesting.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include "resource.h"
int testFunction(char* tester);
int _tmain()
{
char m[40];
std::cin>>m;
testFunction(m);
}
int testFunction(char* tester)
{
char x[100] ;
memset(x,100,sizeof(x));
strcpy_s(x,100,tester);
std::cout<<x;
return 0;
}