Are you new around here? It probably is one of these:
- I let others do my homework
- I am troll
- strcat() isn't safe enough; I prefer strcat_s()
Luc Pattyn [Forum Guidelines][Why QA sucks][My Articles] I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
He wants to implement a function where he needs to takes two char* parameters as input at the end it should return a char* by concatenating these two char* values(without using strcat(), strcmp() functions).
required function prototype is
char* concat(const char* c1, const char* c2)
I am unable to solve this one. Please give me the approach
Thanx in advance.....
To invent something, you need a mountain of junk in your mind.
---------------------Thomas alva edison
Note that in what you are doing, you are dealing with 6 variables. You are talking about the 3 char * variables, but as you said, those are pointers. What you must remember is that pointers are pointers - they are used to point to things, in this case arrays of char. These arrays are not automatically provided. You, the programmer, are responsible for providing them for the pointers to point to.
You have to keep in mind the distinction between pointer and "pointee". Once you do that, you would not say that you want to add or concatenate 2 pointers. Instead, you want to concatenate the 2 strings contained in 2 char arrays and put the result in a third char array. You use the pointers to access the char arrays.
That code is too dangerous for words. As long as the length of buf is greater than the combined length of c1 and c2 plus a null terminator it will work. But as soon as the result overflows all hell breaks loose. This maybe OK for a skilled developer such as yourself, but I would not suggest it as a solution for a newbie.
Please help me choose a component for the following task
I have C++ Win32-application (MS Visual C++ 2005 or 2008) that must:
- periodically (say once in 5 min) check a mailbox via POP3
- retrieve new messages from there, process them (the processing is specific for the my task) and remove the processed messages.
The processing converts body of received mail into plain text (WCHAR* string). I mean: to convert removing formatting elements like HTML tags (when a mail is in HTML format) etc., leaving only text. Now I am not interested in content of attachments - I need only mail's text.
The question is: do you know a component that can solve the task too? Or: one component to read POP3, another one for extracting text from received e-mail. The components may be commercial ones (my employer is rich enough to pay for them