Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: auto start program Pin
mark novak14-Apr-05 11:41
mark novak14-Apr-05 11:41 
GeneralRe: auto start program Pin
22491714-Apr-05 17:49
22491714-Apr-05 17:49 
GeneralAutoscroll a listbox Pin
Anonymous14-Apr-05 10:15
Anonymous14-Apr-05 10:15 
GeneralRe: Autoscroll a listbox Pin
Anonymous14-Apr-05 10:23
Anonymous14-Apr-05 10:23 
GeneralCComboBox without Border Pin
tobi7814-Apr-05 9:22
tobi7814-Apr-05 9:22 
GeneralThread Creation / Server Pin
brilliant10114-Apr-05 8:59
brilliant10114-Apr-05 8:59 
GeneralHelp! Many questions about using CString Pin
tttyip14-Apr-05 6:48
tttyip14-Apr-05 6:48 
GeneralRe: Help! Many questions about using CString Pin
David Crow14-Apr-05 7:59
David Crow14-Apr-05 7:59 
tttyip wrote:
For example, I have a function void testfunction1(const char* input1);
Can I call this function by:
CString s = "c:\\program files";
testfunction1(const char* input1);


Close. What you meant was:

CString s = "c:\\program files";
testfunction1(s);
tttyip wrote:
2) For the Format function of the CString class, the VC++ documentation says "The call will fail if the string object itself is offered as a parameter to Format". Is that we cannot use the Format function in this way?
For example, Can I use the following codes safely?
CString test1 = "c:\\program files\\";
char folder[10] = "folder1";
CString FullPath;
FullPath.Format("%s%s", test1, folder);

Will FullPath be "c:\program files\folder1" ?

If I cannot use this method to for setting FullPath, what should I do to set the FULL path correctly?


What it means is that the following is unsafe:

CString test1 = "c:\\program files\\";
test1.Format("%s%s", test1, "some other text");
You must cast the CString argument as LPCSTR like:

test1.Format("%s%s", (LPCSTR) test1, "some other text");
tttyip wrote:
3) Is the CString object NULL terminated?

You are confusing the object itself with the internal buffer that it maintains. When using CString, you mustn't think of it as a glorified char type. Let the object handle its internals, and you simply interface with it using the supplied methods.

tttyip wrote:
4) What is the maximum number of characters for the CString object?

Up to INT_MAX characters.

tttyip wrote:
5) What is the meaning of "const" in the function argument?
eg. void thisfunction(const char* test, int test2);


It declares a pointer to a constant character, meaning that you cannot change the character.


"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow


GeneralRe: Help! Many questions about using CString Pin
tttyip15-Apr-05 4:58
tttyip15-Apr-05 4:58 
GeneralDialog Insertion Help Pin
BritishEmpire14-Apr-05 5:53
BritishEmpire14-Apr-05 5:53 
GeneralRe: Dialog Insertion Help Pin
mark novak14-Apr-05 11:22
mark novak14-Apr-05 11:22 
GeneralI need help on this problem. Pin
daAnswer14-Apr-05 5:50
daAnswer14-Apr-05 5:50 
GeneralRe: I need help on this problem. Pin
Bob Flynn14-Apr-05 6:27
Bob Flynn14-Apr-05 6:27 
GeneralRe: I need help on this problem. Pin
Anonymous14-Apr-05 15:27
Anonymous14-Apr-05 15:27 
QuestionCookies in MFC? Pin
soundman3214-Apr-05 5:26
soundman3214-Apr-05 5:26 
AnswerRe: Cookies in MFC? Pin
David Crow14-Apr-05 7:47
David Crow14-Apr-05 7:47 
GeneralRe: Cookies in MFC? Pin
soundman3214-Apr-05 21:38
soundman3214-Apr-05 21:38 
QuestionGDI+ bug? Pin
ZHANG, Lei14-Apr-05 5:00
ZHANG, Lei14-Apr-05 5:00 
AnswerRe: GDI+ bug? Pin
PJ Arends14-Apr-05 11:03
professionalPJ Arends14-Apr-05 11:03 
GeneralDisplaying text in a textbox from one form to another form Pin
underb@asd20.org14-Apr-05 4:56
underb@asd20.org14-Apr-05 4:56 
GeneralRe: Displaying text in a textbox from one form to another form Pin
Joel Holdsworth14-Apr-05 12:44
Joel Holdsworth14-Apr-05 12:44 
General[Message Deleted] Pin
Adeel Chaudhry14-Apr-05 4:10
Adeel Chaudhry14-Apr-05 4:10 
GeneralRe: i want two header files of VC6!!! Pin
David Crow14-Apr-05 4:45
David Crow14-Apr-05 4:45 
GeneralRe: i want two header files of VC6!!! Pin
John M. Drescher14-Apr-05 5:47
John M. Drescher14-Apr-05 5:47 
GeneralRe: i want two header files of VC6!!! Pin
ThatsAlok14-Apr-05 19:38
ThatsAlok14-Apr-05 19:38 

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.