Author Topic: No console output when debug with arguments  (Read 3376 times)

Offline 1439808922

  • Single posting newcomer
  • *
  • Posts: 4
No console output when debug with arguments
« on: May 05, 2016, 10:30:09 am »
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???




Offline 1439808922

  • Single posting newcomer
  • *
  • Posts: 4
Re: No console output when debug with arguments
« Reply #1 on: May 05, 2016, 10:38:07 am »
it seems that i should fflush(stdout)  manually  when debugging with arguments????

Offline raynebc

  • Almost regular
  • **
  • Posts: 217
Re: No console output when debug with arguments
« Reply #2 on: May 05, 2016, 09:28:46 pm »
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]);

Offline 1439808922

  • Single posting newcomer
  • *
  • Posts: 4
Re: No console output when debug with arguments
« Reply #3 on: May 06, 2016, 06:02:19 am »
yes