c++ - Use CString with sprintf -
i have c++ code need utilize cstring sprintf. in code i'm creating file names cstrings defined sprintf. code below.
double number; number = 0.25; char buffer [50]; cstring sfile; sfile = sprintf(buffer,"trjfpicd(%3.3f).txt",number); cstring sffile; sffile = sprintf(buffer,"trjfpicv(%3.3f).txt",number); cstring sfffile; sfffile = sprintf(buffer,"trjfpica(%3.3f).txt",number); the desired file names trjfpicd(0.25).txt, trjfpicv(0.25).txt, , trjfpica(0.25).txt. have utilize cstrings code.
the error 'operator =' ambiguous.
take @ cstring::format (ignore cstringt part - cstring derived cstringt). want , allows rewrite code cleanly:
double number = 0.25; cstring sfile; sfile.format(_t("trjfpicd(%3.3f).txt"), number); cstring sffile; sffile.format(_t("trjfpicv(%3.3f).txt"),number); cstring sfffile; sfffile.format(_t("trjfpica(%3.3f).txt"),number); c++ printf cstring
No comments:
Post a Comment