私の文字列:
std::string With_esc = "asd\b";
それを単純な文字列「as」に変換したい(バックスペース文字を適用して忘れる)。C++でこれを行う方法はありますか? 次のようになります。
std::string With_esc = "asd\b";
std::string Without_esc = With_esc; //Here I should convert it
std::ofstream FWith_esc ("with");
std::ofstream FWithout_esc ("without");
FWithout_esc << Without_esc;
FWith_esc << With_esc;
バッシュ:
~ cat -e with
asd^H
~ cat -e without
as
残念ながら、変換方法がわからないため、両方のファイルはまったく同じに見えます。