• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 154
  • Last Modified:

Formatting a string

Hi ,there.

Consider the following code

 int x =0;
 int y =0;
 int z =100;
 int w =100;

 CString string;
 string.Format("%%BoundingBox %d %d %d %d \n" ,x ,y ,z ,w);

 
 I want the function to display something like :

 %%BoundingBox 0 0 100 100

 But it displays:

 %BoundingBox 0 0 100 100  

instead.As you can see , a"%" is missing .How to solve this .If I try and add another "%" at the beginning of the string ,the function asserts.

Thanks.
0
e6694811
Asked:
e6694811
1 Solution
 
cdesignerCommented:
use this
CString string;
string.Format("%%%%BoundingBox %d %d %d %d \n" ,x ,y ,z ,w);

% - special symbol
%% - print one %

0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now