titanandrews
Programmer
Hello,
From reading the docs on the CString::Format() function, I was under the impression that I could use it just like printf. I want to be able to set the width of the field to 10, but this code prints out garbage for CString. The printf() function however works fine. Can someone please tell me what I am doing wrong?
many thanks,
Barry
From reading the docs on the CString::Format() function, I was under the impression that I could use it just like printf. I want to be able to set the width of the field to 10, but this code prints out garbage for CString. The printf() function however works fine. Can someone please tell me what I am doing wrong?
Code:
CString tmp = "Hello";
tmp.Format("%10s",tmp);
cout << tmp.GetBuffer(tmp.GetLength()) << endl; //Garbage
tmp.ReleaseBuffer();
printf("%10s","Hello"); //As expected
many thanks,
Barry