1

文字ポインターに文字列を割り当てる際に問題が発生しました。文字ポインタは、文字列の最初の 256 文字しか取得していないようです。私の64ビットプラットフォームでの作業。また、同じコードが 32 ビット プラットフォームでも正常に機能します。64 ビット プラットフォームの char ポインター変数に 256 文字しか割り当てられない理由がわかりませんでした。どなたか助けてください。

私のテストは

const char *test2=
    "Hello everyone"
    "Please help me"
    "my string assigning part to char pointer in a code is not working"
    "I have been stucked on it for 3 days."
    "I tried lot of things"
    "but the problem persists."
    "I have no idea why the code is not working"
    " Here comes The problem in next line..."
    "If you get this line in the up assigning variable..yuppieee";

const char *test3="Hello everyone .Please help me my string assigning part to char pointer in a code is not working I have been stucked on it for 3 days. I tried lot of things but the problem persists. I have no idea why the code is not working  Here comes The problem in next line... If you get this line in the up assigning variable..yuppieee";

結果

test2 ="Hello everyonePlease help memy string assigning part to char pointer in a code is not workingI have been stucked on it for 3 days.I tried lot of thingsbut the problem persists.I have no idea why the code is not working Here comes The problem in next line.."

test3 ="Hello everyone .Please help me my string assigning part to char pointer in a code is not working I have been stucked on it for 3 days. I tried lot of things but the problem persists. I have no idea why the code is not working  Here comes The problem in nex"

最初の 256 文字のみが変数に割り当てられます。

コード

 #include <iostream>
 #include <string>
#include <conio.h>
using namespace std;
int main()
{

const char *test3="Hello everyone .Please help me my string assigning part to char pointer in a code is not working I have been stucked on it for 3 days. I tried lot of things but the problem persists. I have no idea why the code is not working  Here comes The problem in next line... If you get this line in the up assigning variable..yuppieee";

cout<<test3<<endl<<endl;
getch();
return 0;

}

プロジェクトは、64 ビット コンパイル モードの vs2005 のプロジェクト プロパティで、共通言語サポート ランタイム (/clr) を含むように設定されています。

4

0 に答える 0