problem printing in terminal

Oct 30, 2013 at 9:22pm
i have a function that i am calling:


1
2
3
4
5
  ldu1::ldu1(const_bit_queue& frame_body) :
   voice_data_unit(frame_body)
{
   decode_lcw();
}

i want to lay eyes on the array produced by the called function, decode_lcw() so in the function i put a print statement.
1
2
3
4
5
int i;
    printf("decoded lcw\n");
    for(i=0;i<72;i++)
    printf("%d",decoded_lcw[i]);
    printf("\n");


but i get nothing in terminal. what am i doing wrong here?? THanks!
Oct 30, 2013 at 11:05pm
Are you sure the code is even being called?
Have you tried using a debugger and verifying that those statements are being reached?
Oct 31, 2013 at 1:22am
i don't have a debugger. i was under the impression that what i did up top on line 4 would be a proper functions call.
Oct 31, 2013 at 7:54am
One possibility is that the standard output (via printf) is buffered, and you don't see the output because the data is still waiting in the output buffer. You could try adding fflush(stdout); after the last printf() statement in function decode_lcw().

If you still see nothing, then it is reasonable to conclude that that code is not being executed, presumably because the calling function itself is not executed. Or maybe because of some logical condition (if-else etc.) which you may have assumed is true, but isn't.
Topic archived. No new replies allowed.