私は C++ の初心者です。次のような内容のテキスト ファイルがあります。
Systemname localtesthost
SystemIp X.X.X.X
Systemowner root
...
ここで、「Systemname」の値、つまり「localtesthost」を抽出したいと思います。
そして、「Systemname localtesthost」を含む行を抽出できますが、文字列「Systemname」を抽出する方法がわかりません。
以下は私のプログラムです。
const char* configInfoFile = "config_info";//the text file name
ifstream ifs(configInfoFile);
string line;
while(getline(ifs,line)) {
if(line.length() > 0){
int index = line.find("SystemName");
if (index != -1)
{
.
.
}
}
}
文字列を抽出する方法を教えてもらえます"localtesthost"
か?
どうもありがとう!