Overview
Features
Download
Documentation
Community
Add-Ons & Services

snprintf functionality in Poco

A general discussion forum.

snprintf functionality in Poco

Postby pocouser » 18 Aug 2008, 08:57

hi i want the data in form of first 5 bytes stores length of the data in text format and remaining bytes will have the actual data.

in c we can use
int Datasize = sizeof(datastruct);
snprintf(Datatosendbuffer, lnLength, "%05d", Datasize);

after copying the length of the data in text format the actual data will be copied in Datatosendbuffer buffer.

I want to know how in poco do we get the above functionality of snprintf?
Thanks
pocouser
 
Posts: 6
Joined: 13 Aug 2008, 09:32

Re: snprintf functionality in Poco

Postby guenter » 18 Aug 2008, 10:51

See the format function in Poco/Format.h and the NumberFormatter class in Poco/NumberFormatter.h. Alternatively, you can use iostreams (e.g., std::stringstream).
guenter
 
Posts: 1121
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: snprintf functionality in Poco

Postby pocouser » 22 Aug 2008, 08:57

thanks.
pocouser
 
Posts: 6
Joined: 13 Aug 2008, 09:32


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron