News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

No console output when debug with arguments

Started by 1439808922, May 05, 2016, 10:30:09 AM

Previous topic - Next topic

1439808922

int main(int argc,char *argv[])
{
for(int i=0;i<argc;i++)
    printf("%s ",argv);

return 0;                                     -----breakponit

}

the above code has  no console output  .

But

int main(int argc,char *argv[])
{
int a;
for(int i=0;i<argc;i++)
    printf("%s ",argv);
scanf("%d",&a);

return 0;                       
}

does have output.


what should i do???




1439808922

it seems that i should fflush(stdout)  manually  when debugging with arguments????

raynebc

In your loop, did you mean to do this instead (print each command line argument to console)?
for(int i=0;i<argc;i++)
    printf("%s ",argv[i]);