User forums > Help

No console output when debug with arguments

(1/1)

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)?

--- Code: ---for(int i=0;i<argc;i++)
    printf("%s ",argv[i]);
--- End code ---

1439808922:
yes

Navigation

[0] Message Index

Go to full version