Click here to Skip to main content
15,881,938 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: quine mccluskey method on C/C++ Pin
Reuben Cabrera2-Oct-14 23:03
Reuben Cabrera2-Oct-14 23:03 
QuestionMFC- receiving Button-Click-Message failed Pin
Member 111256242-Oct-14 4:05
Member 111256242-Oct-14 4:05 
AnswerRe: MFC- receiving Button-Click-Message failed Pin
Richard Andrew x642-Oct-14 10:47
professionalRichard Andrew x642-Oct-14 10:47 
GeneralRe: MFC- receiving Button-Click-Message failed Pin
Member 111256243-Oct-14 1:15
Member 111256243-Oct-14 1:15 
Questionreplace malloc by new Pin
_Flaviu2-Oct-14 2:32
_Flaviu2-Oct-14 2:32 
AnswerRe: replace malloc by new Pin
_Flaviu2-Oct-14 3:02
_Flaviu2-Oct-14 3:02 
Questionhow to utilize "(int argc, const char * argv[]) " in a program Pin
Stefan611-Oct-14 13:25
Stefan611-Oct-14 13:25 
AnswerRe: how to utilize "(int argc, const char * argv[]) " in a program Pin
enhzflep1-Oct-14 19:59
enhzflep1-Oct-14 19:59 
argc = arg count
*argv[] = an array of argc number of strings.


Consider the following program:
C++
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int i;
    for(i=0; i<argc; i++)
        printf("Argument index %d: %s\n", i, argv[i]);

    return 0;
}


When I call the program from the command line like so:
argcdemo arg1 arg2 -someFlag -somethingElse


I get the following output:
Argument index 0: argcdemo
Argument index 1: arg1
Argument index 2: arg2
Argument index 3: -someFlag
Argument index 4: -somethingElse


So as you can see, the first one takes the name of the program as invoked, the others get a string from the command line, where each string is separated by a space. Or more simply, the argc will always be at least 1,since you have to specify the name of the program to run. Any subsequent arguments will increment argc and have their values added to the argv array. Smile | :)
"When I was 5 years old, my mother always told me that happiness was the key to life. When I went to school, they asked me what I wanted to be when I grew up. I wrote down 'happy'. They told me I didn't understand the assignment, and I told them they didn't understand life." - John Lennon

AnswerRe: how to utilize "(int argc, const char * argv[]) " in a program Pin
CPallini1-Oct-14 22:03
mveCPallini1-Oct-14 22:03 
QuestionIs it possible to bind the "this" pointer Pin
elelont230-Sep-14 20:30
elelont230-Sep-14 20:30 
AnswerRe: Is it possible to bind the "this" pointer Pin
CPallini30-Sep-14 21:48
mveCPallini30-Sep-14 21:48 
AnswerRe: Is it possible to bind the "this" pointer Pin
CubbiMew1-Oct-14 16:42
CubbiMew1-Oct-14 16:42 
QuestionOnly Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s30-Sep-14 2:53
narmadha_s30-Sep-14 2:53 
QuestionRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
Richard MacCutchan30-Sep-14 6:04
mveRichard MacCutchan30-Sep-14 6:04 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s6-Oct-14 19:33
narmadha_s6-Oct-14 19:33 
GeneralRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
Richard MacCutchan6-Oct-14 21:13
mveRichard MacCutchan6-Oct-14 21:13 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
David Crow30-Sep-14 9:25
David Crow30-Sep-14 9:25 
GeneralRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
narmadha_s6-Oct-14 19:42
narmadha_s6-Oct-14 19:42 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
David Crow7-Oct-14 2:24
David Crow7-Oct-14 2:24 
AnswerRe: Only Desktop capturing without some active windows or capture only Desktop i.e Desktop Background and Icons Pin
Software_Developer6-Oct-14 23:37
Software_Developer6-Oct-14 23:37 
QuestionChange LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
_Flaviu30-Sep-14 0:01
_Flaviu30-Sep-14 0:01 
AnswerRe: Change LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
Richard MacCutchan30-Sep-14 0:21
mveRichard MacCutchan30-Sep-14 0:21 
AnswerRe: Change LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
Freak3030-Sep-14 0:23
Freak3030-Sep-14 0:23 
GeneralRe: Change LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
_Flaviu30-Sep-14 0:35
_Flaviu30-Sep-14 0:35 
GeneralRe: Change LVS_ALIGNLEFT by LVS_ALIGNTOP Pin
Richard MacCutchan30-Sep-14 0:45
mveRichard MacCutchan30-Sep-14 0:45 

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.