CString WriteString;
....
WriteString.Format("%s.%d d",WriteString,NI);
At above WriteString
the buffer too small warning is shown when executed any times because CString
type is not enough to hold string of any size.
My goal is to get content of WriteString
to write in to a file at end.
But it shows the warning when size of WriteString
reach to a limit. Is there any other way to write these strings to a file?or make the WriteString be of unlimited size.
Solution 1:
In the Format(..) context,
try to use the string as the receiver only :
CString cszComposed(_T("SomeValue"));
...
CString cszTemp;
cszTemp.Format(_T(".%d d"), NI);
cszComposed += cszTemp;
Solution 2:
WriteString.AppendFormat("%du.",NI,CPianoCtrl::NoteUporDwn);
This also works.