Click here to Skip to main content
15,920,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to get position and size of document area in IE window Pin
Waldermort10-Feb-07 0:07
Waldermort10-Feb-07 0:07 
AnswerRe: How to get position and size of document area in IE window Pin
Naveen10-Feb-07 0:16
Naveen10-Feb-07 0:16 
QuestionDoes not allocate memory to buffer Pin
john56329-Feb-07 22:57
john56329-Feb-07 22:57 
AnswerRe: Does not allocate memory to buffer Pin
Christian Graus9-Feb-07 23:02
protectorChristian Graus9-Feb-07 23:02 
GeneralRe: Does not allocate memory to buffer Pin
john56329-Feb-07 23:10
john56329-Feb-07 23:10 
QuestionRe: Does not allocate memory to buffer Pin
David Crow12-Feb-07 3:07
David Crow12-Feb-07 3:07 
QuestionCombining a LPCSTR and an int Pin
ceejeeb9-Feb-07 22:53
ceejeeb9-Feb-07 22:53 
AnswerRe: Combining a LPCSTR and an int Pin
Christian Graus9-Feb-07 23:08
protectorChristian Graus9-Feb-07 23:08 
The best way to do this is to use a wrapper like std::string, or CString. The C way to do this, is to use string manipulation methods. The method that gets a string from a number is sprintf. The method to combine strings is strcat.


strcat(test, sprintf("%d", count));

Here are the wrinkles:

1 - you say test is a LPCSTR. C stands for const, so it can't be changed
2 - this method does not allocate memory, test needs to have enough space allocated after the null terminator to make room for a copy of the number string.
3 - I did this inline, but that will leak memory, you need to make a copy of the string with the number, allocate memory to a new string that includes enough space for both strings, then use strcpy to copy the first one over, and strcat to copy over the second.
4 - if you're using VS2005, you'll need to use the new 'safe' versions or you will get warnings

So much easier to use C++.

ostringstream ss;
ss << "Count=" << 5;
string s= ss.str();

Something like that.

http://www.codeproject.com/vcpp/stl/ostringstream.asp[^]

Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog

QuestionRegistered ActiveX Controls Pin
Try9-Feb-07 22:51
Try9-Feb-07 22:51 
AnswerRe: Registered ActiveX Controls Pin
Joan M9-Feb-07 22:57
professionalJoan M9-Feb-07 22:57 
GeneralRe: Registered ActiveX Controls Pin
Try9-Feb-07 23:05
Try9-Feb-07 23:05 
GeneralRe: Registered ActiveX Controls Pin
Naveen9-Feb-07 23:25
Naveen9-Feb-07 23:25 
GeneralRe: Registered ActiveX Controls Pin
Joan M10-Feb-07 1:05
professionalJoan M10-Feb-07 1:05 
QuestionBuilding an MFC in Release Mode Pin
Member 17658779-Feb-07 21:03
Member 17658779-Feb-07 21:03 
AnswerRe: Building an MFC in Release Mode Pin
Michael Dunn9-Feb-07 21:10
sitebuilderMichael Dunn9-Feb-07 21:10 
Question2 Process at a time in Win 32 App Pin
Suresh H9-Feb-07 17:56
Suresh H9-Feb-07 17:56 
AnswerRe: 2 Process at a time in Win 32 App Pin
Naveen9-Feb-07 18:04
Naveen9-Feb-07 18:04 
GeneralRe: 2 Process at a time in Win 32 App Pin
Suresh H9-Feb-07 18:31
Suresh H9-Feb-07 18:31 
QuestionRe: 2 Process at a time in Win 32 App Pin
Suresh H9-Feb-07 18:56
Suresh H9-Feb-07 18:56 
AnswerRe: 2 Process at a time in Win 32 App Pin
Naveen9-Feb-07 19:16
Naveen9-Feb-07 19:16 
GeneralRe: 2 Process at a time in Win 32 App Pin
Suresh H9-Feb-07 19:33
Suresh H9-Feb-07 19:33 
GeneralRe: 2 Process at a time in Win 32 App Pin
Naveen9-Feb-07 19:50
Naveen9-Feb-07 19:50 
GeneralRe: 2 Process at a time in Win 32 App Pin
Suresh H9-Feb-07 19:53
Suresh H9-Feb-07 19:53 
GeneralRe: 2 Process at a time in Win 32 App Pin
S Douglas10-Feb-07 22:43
professionalS Douglas10-Feb-07 22:43 
Questionhow can i pass my array object in function arguments by reference? Pin
amitmistry_petlad 9-Feb-07 16:59
amitmistry_petlad 9-Feb-07 16:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.