を使用して、318文字で切り取られたchar配列Helloこんにちは私はchar arrays (strings)
には318 characters
を何も表示しないという問題があります。私がstd::string
を実行しても問題なく表示されますが、std::string.c_str()
を使用して文字配列に変換しようとすると、最初に318 characters
が生成されます。どんな助けでも大歓迎です。私はVisual Studio 2017
を使用しています。実際の文字列の長さは517chars
です。ビジュアルスタジオ2017 C++
例...
std::string x = "INSERT INTO oms.Customers (customerFirstName, CustomerMiddleInitial, customerLastName, customerPrefixSuffix, customerCompanyName, customerStreetReference, customerStreetAddress, customerCity, customerState, customerZip, CountryID, customerPhoneNumber, customerEmail, customerIsCompany, customerIsActive) Values('Bill', '
INSERT INTO oms.Customers(customerFirstName, CustomerMiddleInitial, customerLastName, customerPrefixSuffix, customerCompanyName, customerStreetReference, customerStreetAddress, customerCity, customerState, customerZip, CountryID, customerPhoneNumber, customerEmail, customerIsCompany, customerIsActive)Values('Bill', ' ', 'Cosby', '', 'The Cosby Show', 'Studio A', '1818 broadway st', 'Philadelphia', 'PA', '19809', '', '6169875942', '[email protected]', '', ');SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY];"
が、私は、そのような私が
char *y;
y= x.c_str
をしたかのようにchar配列の任意の型を作る場合、私は場合にのみ、以下の
INSERT INTO oms.Customers (customerFirstName, CustomerMiddleInitial, customerLastName, customerPrefixSuffix, customerCompanyName, customerStreetReference, customerStreetAddress, customerCity, customerState, customerZip, CountryID, customerPhoneNumber, customerEmail, customerIsCompany, customerIsActive) Values('Bill', '
が表示されますstrlen(y)
私は318
を取得します。私がx.length()
の場合は517
となります。
ご協力いただければ幸いです。ありがとうございました。
char y [1000000]はなぜですか?そのようにchar配列のサイズを簡単に設定できます。 – QuIcKmAtHs