473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

StringCbPrintf - multiple params

I'm trying to concat multiple params. My code only grabs the first param.

/*******/

// Param1: OLE2T(menuItemsData[idCmd])
// Param2: pStrClipboardText
int const arraysize = 30;
TCHAR pszDest[arraysize];
size_t cbDest = arraysize * sizeof(TCHAR);
LPCTSTR pszFormat = TEXT("%s");

HRESULT hr = StringCbPrintf(pszDest, cbDest,
pszFormat,OLE2T(menuItemsData[idCmd]),_T(pStrClipboardText));

what am i doing wrong??

Thanks

Oct 19 '06 #1
1 2110
mgonzales3 wrote:
I'm trying to concat multiple params. My code only grabs the first param.

/*******/

// Param1: OLE2T(menuItemsData[idCmd])
// Param2: pStrClipboardText
int const arraysize = 30;
TCHAR pszDest[arraysize];
size_t cbDest = arraysize * sizeof(TCHAR);
LPCTSTR pszFormat = TEXT("%s");

HRESULT hr = StringCbPrintf(pszDest, cbDest,
pszFormat,OLE2T(menuItemsData[idCmd]),_T(pStrClipboardText));

what am i doing wrong??

Thanks
Format is TEXT("%s"), then it will only process first parameter. Try
_T("%s, %s")

For
string concatenation, std::basic_stringstream<TCHARis recommended.

#include <sstream>

std::basic_stringstream<TCHARss;
ss<< OLE2T(menuItemsData[idCmd]) << _T(pStrClipboardText);
Oct 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: SPG | last post by:
Hi, I have a servlet application that I am trying to write a very basic load tester for. There application has several servlets, but all rely on the same session being used (IE: For logged in...
18
by: googleboy | last post by:
I didn't think this would be as difficult as it now seems to me. I am reading in a csv file that documents a bunch of different info on about 200 books, such as title, author, publisher, isbn,...
5
by: johkar | last post by:
This script works fine if all form fields have one value, but what do you do if one of the form fields was a multiple select? Example: status=blue&status=red function getParams() { var...
3
by: googleboy | last post by:
Hi there. I have defined a class called Item with several (about 30 I think) different attributes (is that the right word in this context?). An abbreviated example of the code for this is: ...
1
by: Laphan | last post by:
First of all, my apologies for the xpost. I realise the netiqute, but this query seems to cross the boundaries of both these groups. Basically I have created a small ASP site that allows a user...
3
by: 455 | last post by:
Hello all, I've been trying to figure this out for hours now... can anyone help? I have an XML document like this: <?xml version="1.0" encoding="utf-8" ?> <ICE:ServiceCall xmlns="ICE"...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
12
by: Dennis D. | last post by:
Hello: I want a function to return three variables to the calling procedure: Private Function CalcTimes(ByVal iAddDays as Integer, ByVal iAddHours as Integer, ByVal iAddMins as Integer) As...
5
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.