|
bouli wrote: Can someone show me a code snipet that shows how can I parse the command line in C? I need to parse an IP address and a port number (no matter the order it is passed).
http://www.codeproject.com/cpp/caacommandlineclass.asp
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow cheers, Alok Gupta VC Forum Q&A :- I/ IV
|
|
|
|
|
In C only... no C++
thanks anyway
There is no spoon.
|
|
|
|
|
bouli wrote: In C only...
GetCommandLine
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow cheers, Alok Gupta VC Forum Q&A :- I/ IV
|
|
|
|
|
"in C", do you mean with the standard main function ? Here are the parameters :
main
main( int argc, char *argv[ ])
{
program-statements
}
The main function marks the beginning and end of program execution. A C or C++ program must have one function named main.
The main and wmain functions can take the following three optional arguments, traditionally called argc, argv (in that order):
argc
An integer specifying how many arguments are passed to the program from the command line. Because the program name is considered an argument, argc is at least 1.
argv
An array of null-terminated strings. It can be declared as an array of pointers to char (char *argv[ ] ) or as a pointer to pointers to char (char **argv ). The first string (argv[0]) is the program name, and each following string is an argument passed to the program from the command line. The last pointer (argv[argc]) is NULL.
So with argc you have the number of parameter give nto the command line, and these parameters are contained in argv.
~RaGE();
|
|
|
|
|
ok, got it.
thanks
There is no spoon.
|
|
|
|
|
bouli wrote: There is no spoon.
What is the meaning of this ?
~RaGE();
|
|
|
|
|
It's a quote from The Matrix.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
As everybody asks for it: it comes from "The Matrix".
There is no spoon.
|
|
|
|
|
I know that.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Probably means you need to find things out for yourself or work them out for yourself - no one there to feed you with a spoon like a little baby.
|
|
|
|
|
See here.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi!
I have a dialog on that dialog I have a static control on which I draw some fig. I have 2 radio controls placed under that static control.
My problem is I am not able to click on those radio controls...more over I am not getting any mouse message even on static control.
This static control is subclassed and only WM_PAINT is handeled.
If I keep radio buttons on the top of static control ( I mean tab order) then still there are no mouse messages for static control but I can click on radio button.
In this case the problem is painting...when ever I say invalidaterect for my static control radiobuttons are not painted.
I have tried doing InvalidateRect for radio controls also after invalidating static control but result is same.
pls. let me know some solution.
Thanks
|
|
|
|
|
Naveen_mah wrote: I am not getting any mouse message even on static control
Take a look at SS_NOTIFY in MSDN . In the dialog editor set Notify property to true .
Naveen_mah wrote: If I keep radio buttons on the top of static control ( I mean tab order) then still there are no mouse messages for static control but I can click on radio button.
This is absolute mayhem. What do you want to do. Why don't you use a group box instead.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Hi!
Thanks for your answer but SS_NOTIFY or NOTIFY did not solve my problem.
I think I have made it quite confusing..It looks something like the drawing below..
______________
| |
| |
| |
| |
| |
| |
| |
|o radio o rad|
| |
|_____________|
(if it does not show as rectangle pls consider it as rectangle)
The rectangle above is static control and there are 2 radio controls....I can place them above or below static (tab order)...
My problem is I am not getting any mouse message from static control in any way.
Hope my problem is little clear
-Naveen
|
|
|
|
|
|
I noticed this warning today in my build messages:
warning C4018: '<' : signed/unsigned mismatch
I have been ignoring it all along till now and its been working fine.
Just wondering when this comparison of an "int" with "unsigned int" can actually lead to an expected error. If both the integers I am comparing are smaller than [max value of "int"] and are positive, then I guess I am safe. Is this correct?
thanks!
|
|
|
|
|
You are right, as long as the values are < 32768.
|
|
|
|
|
|
kakan wrote: as long as the values are < 32768
<= !!!
my mistake, you're right. sorry
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 5:38 Friday 20th January, 2006
|
|
|
|
|
Really ? I thought -32768 <= int <= 32767 ? Or did I misunderstand your thread ?
~RaGE();
|
|
|
|
|
arf, nop, you're right...
maybe i am not woke up correctly, because i had in mind that it was between [-32767 ; +32768]
my mistake...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
-- modified at 5:46 Friday 20th January, 2006
|
|
|
|
|
I sort of remember it easily, because of the following story:
<free entertainement="">
Here we are working on 16bit microcontrollers, meaning our greater available type is int. We usually work with signed int. Recently we had a reset due to our math function that was computing the absolute values. This function would do :
void Abs(param)
{
if (param<0) return (-param) else return param;
}
of course, when param was equal to -32768, the function did return an overflow, since --32768 = 32768 cannot be contained by an int
~RaGE();
|
|
|
|
|
i'll try to remember that
however, off topic remark :
if (param<0) return (-param) else return param;
is missing a ';' before else statement...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Actually, we were both wrong.
An int is 4 bytes, not two (anymore). That's true for Win32 anyway.
So the overlapping region of positive values is in the interval 0x00000000 to 0x7fffffff. Or in decimal: 0 to 2147483649.
0x80000000 is a negative number for a signed int, since the MSB (most significant bit) == 0x1.
|
|
|
|
|
A TRUE programming genius would just include limits.h and use INT_MIN and INT_MAX ... :->
|
|
|
|