|
|
if you are a firewall, you see all network packets that have your IP address as a source or destination, so by watching traffic you can build a list of all other IP addresses of interest.
|
|
|
|
|
Hi Luc, Thanks for your reply.
|
|
|
|
|
Hi All,
I am getting a CString variable which has a value like this
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
I have to process all these tab and newline before sending this CString variable to to 3rd party function.
Example:
This is what I receive:
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
I have send this str like this to the 3rd party function:
str = "ABCD EFGH IJKL MNOP
QRST"
Please give your suggestions.
Thanks,
Joseph
|
|
|
|
|
Can't you use the CString::Replace() method?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I dont want to replace anything. If I find a \t then I have to execute that \t. Please see the example below.
Execute means, if there is a \t then I have to give 5 spaces (tab).
If there is a \n then I have to move the remaining string to the next line.
I have to process this str:
str = "ABCD\tEFGH\tIJKL\tMNOP\nQRST"
like this:
str = "ABCD(TAB)EFGH(TAB)IJKL(TAB)MNOP(NEWLINE)QRST"
There should be 5 spaces in (TAB)
A newline should be in (NEWLINE)
Thanks,
Josef
|
|
|
|
|
Joseph82 wrote: I dont want to replace anything
Yes, that's what you want to do: you want to replace the string "\t" by a tab character and the string "\n" by a newline character. So you have to replace a sequence "\\t" by a sequence "\t" (that's what you have to specify to the replace function, since you have to escape the "\" character).
Executing a '\t' doesn't mean anything, you can't "execute" a tab or a new line.
|
|
|
|
|
Thanks. But how to do it.
How will I get this output in the CString Variable:
str = "ABCD(5spaces)EFGH(5spaces)IJKL(5spaces)MNOP(newline)QRST"
Thanks
Josef
|
|
|
|
|
Did you check the post from David ? Check the documentation of the function to see how to use it.
|
|
|
|
|
you want to replace the actual "tab" character with the "visual" representation of the tab ?
for example what would happen if the tab is visually represented by 2 spaces or by 3 spaces ?
Watched code never compiles.
|
|
|
|
|
|
so, just replace (CString::Replace) the "\t" with " ".
Watched code never compiles.
|
|
|
|
|
What should I do for newline?
|
|
|
|
|
It make no sense to "execute" a newline inside a string! Inside a string you could put printable characters, like 'a', 'b', 'c' and so on, and/or control characters, like '\t' (i.e. TAB), '\n' (i.e. LF) and so on.
If you pass such a string to functions like printf , that functions will print-out the printable characters and do what the control characters ask for, for example:
printf("first>\tthis is a sentence...\nsecond>\tthis is another sentence...")
will produce an output on screen similar to the following:
first> this is a sentence...
second> this is another sentence...
as you can see TAB (\t) is not simply expanded to a certain number of characters, but it make the text formatted in columns; the LF instead instruct the printf function to move to the beginning of the next line and place the remaining text there.
Then:
- if you like it, you can replace the TABs expanding them to a fixed number of spaces (supposed that you have a
CString named str , you have only to call str.Replace(_T("\t"), _T(" ")); on it); be aware that usually this is not the behaviour of TAB that the rest of the world is expecting. - absolutely it make no sense to replace the \n characters in a string with newline because in strings \n has the meaning of newline!
|
|
|
|
|
|
Hi Friends,
I am presently doing a project in VC++(VS 2008). it having more than 40 dialog's. for that dialogs i'm designing with controls... it is difficult me to maintain the dialogs good and perfect without missing the alignment's...
so please tell me some tips about designing and how to design the dialogs effectively...
Thanks in advance... Rose ...
|
|
|
|
|
|
|
rp_suman wrote: To make sure if the controls are aligned correctly, you can take a snapshot, paste in MS Paint, draw a line, zoom and check the pixels.
If you really like to work, and like spending your customers cash, that may be a good alternative to simply use the alignment tools in the Format | Align sub-menu in the resource editor.
|
|
|
|
|
|
Hi,
I need to update a code that was written a long time ago, and have some problem.
my question is as follow.
I have a Base class with function f1 that do something.
the Derived class ovveride function f1 and do other thing.
now I need to add to the derived class a function f2 that do exactly what Base::f1() is doing.
and I dont want to duplicate the code (of course)
is it OK to do:
void Derived::f2()
{
Base::f1();
}
or is there a better way to call the f1 from the base class?
Many thanks,
|
|
|
|
|
lune12 wrote: Base::f1();
That's how you should do it.
|
|
|
|
|
You don't actually have to implement a function to call a base class version of a function:
Derived d;
d.base::f();
will call the base class version of f - no virtual function dispatch will happen.
Oh, don't try this the other way around - strange and destructive things will happen
Cheers,
Ash
|
|
|
|
|
Actually there are scenarios where this is useful, like exposing methods from private and protected inheritance. A sort of forwarding.
class Base
{
public:
string name() const;
};
class Derived : protected Base
{
public:
string name() const { return Base::name(); }
};
Edit: The reason being of course to change the access level of a method.
|
|
|
|
|
Just a thought: As someone who prefers composition over inheritance, I can hardly think of a case using protected/private inheritance. Not sure when I used it last time. Also see Stackoverflow[^].
Cheers
/Moak
|
|
|
|