###前提・実現したいこと
文字列から整数へ数字を変換したい。
###発生している問題・エラーメッセージ
下のエラーを消すにはどうしたらいいでしょうか。
あるいは、他に良い方法はないでしょうか。
エラー C3867 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>::c_str': 非標準の構文です。メンバーにポインタを作成するには '&' を使用してください c:\visualstudio\sample\sample\interchange.cpp 8 エラー C2512 'std::istrstream::istrstream': クラス、構造体、共用体に既定のコンストラクターがありません。c:\visualstudio\sample\sample\interchange.cpp 8
###該当のソースコード
#include<iostream> #include<string> #include<strstream> using namespace std; int main() { string s("123"); istrstream istr(s.c_str); int i; istr >> i; cout << i << endl; }
###補足情報(言語/FW/ツール等のバージョンなど)
vs2015です
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。