|
They are used for command line parameters. argc tells you how many elements are in the argv array. argv holds the space-delimited strings.
Say you write a program that will write out a given string X number of times and you want to allow the user to determine what the string is and how many times by passing in command line parameters:
MyEcho.exe 5 Hello!
argc would be 3 (1 for the module name, and then the parameters).
argv would hold the parameters to parse for the program.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
For command line arguments.
Basically, if you have an executable named "app.exe" and you a the command line like this:
app.exe your_arg1 your_arg2
then argc is 3, argv[1] is "your_arg1" and argv[2] is "your_arg2".
Note that argv[0] is always "app.exe".
Best,
Jun
|
|
|
|
|
See here.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi All
Does anyone know the best way to check if another application is running ?
I need to check from one application to see if another is open, perhaps by checking in task manager
but im not sure how to go about this
Anyone any ideas ??
Simon
|
|
|
|
|
|
You can also use the Process32First() /Process32Next() pair.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi
I am reading an article.
It is about COM.http://www.codeproject.com/com/comintro.asp
<br />
HRESULT hr;<br />
IShellLink* pISL;<br />
<br />
hr = CoCreateInstance ( CLSID_ShellLink,
NULL,
CLSCTX_INPROC_SERVER,
IID_IShellLink,
(void**) &pISL );
<br />
if ( SUCCEEDED ( hr ) )<br />
{<br />
}<br />
else<br />
{<br />
}<br />
Here pISL is a pointer to pointer.But in that definition what is the role of '&'?
Is pISL is a reference type or it is address operator.If it is adress i don't understand the meaning of such a definition.
CAn you please explain?
|
|
|
|
|
Reference type is only in a declaration. An "operator" can be applied to a variable so that is an operator.
led mikeLast modified: Tuesday, August 29, 2006 12:41:26 PM -- fat finger
|
|
|
|
|
So pISL is pointer to pointer to pointer?Because void** is pointer to pointer to an adress of pISL.
Am i wrong?
|
|
|
|
|
sawerr wrote: Am i wrong?
Yes you are wrong.
IShellLink* pISL;
It is a pointer... so you need to get the Address of it to pass the "pointer to a pointer" parameter.
(void**) &pISL
Does that help?
led mike
|
|
|
|
|
)
Oh sorry.this is very silly error.I am laughing myself.
I think i must wash my face.
Thanks...
|
|
|
|
|
Hi!
I have a big windows application which doesnt support unicode yet. But in one specific Edit box, i need to correctly process the data that will be entered there, it can be a simple text or a chinese text. How can I correctly process the data without making all the project in UNICODE. Because its too much work for this time to modify all the code to support unicode.
How can the Edit box handles the data and what data type should i save the data for further processing? How can i know if the entered data is chinese (2 bytes) or just a simple text (1 byte)?
Please help.
Newbie
|
|
|
|
|
lorey wrote: How can I correctly process the data without making all the project in UNICODE.
You can still use wchar_t in a non-Unicode application.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
my VC6 project says "can not acssese ClassView infomation file, ClassView information will not be avalable".
which file is "ClassView information" file in VC6?
how to solve the problem?
|
|
|
|
|
The .ncb file holds the classview information,
the .clw file holds ClassWizard information.
If the file exists, it is most likely corrupted. Delete it and it will be recreated when you load the workspace again. It is a definite 'issue' to have the file loaded by more than one copy of MSDEV at a time!
Steve S
Developer for hire
|
|
|
|
|
hello there!!!!
i just wanna ask:
1 how to install and use a webcam using vb 6.0
2. how to save a picture in ms access
thanks!!!!!!!!!!
adikkaymonic
|
|
|
|
|
|
Those VBers are always getting lost.
led mike
|
|
|
|
|
unfortunately, not only them...
|
|
|
|
|
How to read from a string
char str[] = "field1 field2 field3 ..."
only one field3 string using sscanf() and one buffer for it - tmp.
sscanf(str,"%s %s %s",0,0,tmp);
it produces exception in this case
9ine
|
|
|
|
|
9ine wrote: sscanf(str,"%s %s %s",0,0,tmp);
Replace zeroes by address of variables because sscanf expects some address to be passed in. You are passing in NULL hence the exception I guess.
char str[] = "15 12 14";
int num1,num2,num3;
num1=num2=num3=0;
sscanf(str, "%d %d %d", &num1, &num2, &num3 );
printf( "Num1: %d, num2: %d, num3: %d", num1, num2, num3 );
|
|
|
|
|
I want to use just one variable to its arguments list.
Consider if I need to read 20th field from a string I dont want to declare
int num1,num2,num3,num4, ........... num20
to read last field
9ine
|
|
|
|
|
9ine wrote: Consider if I need to read 20th field from a string I dont want to declare
int num1,num2,num3,num4, ........... num20
to read last field
sscanf isn't the right function for doing this. And using the %s option for sscanf isn't advised since it will almost never do what you hope it will. In fact, only your first %s will be read in and you will corrupt memory with the other 2 (even after fixing your references to the variables).
If you are looking to access a single (or even a few) elements in a delimited string, write a split method, or use strtok to march through the array to the elements you want to access.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
9ine wrote: sscanf(str,"%s %s %s",0,0,tmp);
Use:
sscanf(str, "%*s %*s %s", tmp); 9ine wrote: it produces exception in this case
As it should since you are trying to write to address 0.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|